On Wed, Dec 16, 2020 at 8:49 AM Sean <s.tolstoyev...@gmail.com> wrote:

> i have a project I have to work with CGo. I want to disable some
> controls as they are not good enough right now.
> It works when I write "set godebug=cgocheck=0" on Windows in console.
> However, this is a GUI program. Console should not open.
>
> I tried this with "os.Setenv". I define it in "func init" it doesn't work.
>
> Something like this:
>
> func init() {
>      os.Setenv("godebug", "cgocheck=0")
> }
>
> What should I do?
>

The easiest solution is a wrapper script that sets the desired environment
variables then launches the target program. I don't use MS Windows but on
UNIX like platforms I would create a script like this:

#!/bin/sh
GODEBUG=cgocheck=0 exec /path/to/real/program "$@"


 I would normally rename the target program and install the wrapper script
as the name of the target program to make the presence of the wrapper
"invisible".

-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CABx2%3DD8i_BMk5TfhKifPhdN_LUxU66pHqgOuGgpj812ac04yow%40mail.gmail.com.

Reply via email to