The solution thanks to @kostix:
I added before PetscInitialize:
if err := PetscOptionsSetValue(nil, "-no_signal_handler", "true"); err != nil {
panic("could not set option")
}
with
func PetscOptionsSetValue(options c_PetscOptions, name, value string) error {
c_name := c_CString(name)
defer c_free(unsafe.Pointer(c_name))
c_value := c_CString(value)
defer c_free(unsafe.Pointer(c_value))
if cIerr := c_PetscOptionsSetValue(options, c_name, c_value); cIerr != 0 {
return errors.New("Could not PetscOptionsSetValue, error-code: " + strconv.Itoa(int(cIerr)) + "\n")
}
return nil
}
and
type c_PetscOptions = C.PetscOptions
func c_PetscOptionsSetValue(options c_PetscOptions, name *c_char, value *c_char) c_PetscErrorCode {
return C.PetscOptionsSetValue(options, name, value)
}
It also seems working when I moved the setting of the option and the initialization in func init() and remove runtime.LockOSThread().