You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It uses all old/other environment variables that may be set in the environment and may somehow influence the build system, like CGO_FLAGS
It literally adds new environment variables to the list and all the old ones are preserved. What if someone had GO111MODULES=off and now it sets it to on? Well, it will then all depend on the underlying code that processes environment variables: if the code iterates over the slice and gets the value from the first variable that matches the key, then we will use incorrect value.
It may also be good to document the GO111MODULES stuff better in the project README or/and inform the user with an info log about us setting it for the package load.
The text was updated successfully, but these errors were encountered:
disconnect3d
changed the title
Potential issue with environment variables
Potential issues with setting environment variables
Mar 20, 2023
I agree. It would probably be better if the command line flags that the user wants to pass on to the build system are provided explicitly.
The documentation for packages.Load specifies that later entries take priority.
Yes, it would be good to improve the documentation. There's a small piece of documentation in the help text for the -modulepath flag, but it doesn't tell you that GO111MODULE will be set to off when the flag is not passed.
Hi,
Currently, the
LoadPackage
function adds environment variables this way:goat/pkgutil/load.go
Lines 51 to 54 in e7b9eed
However, this may not be the best approach since:
CGO_FLAGS
GO111MODULES=off
and now it sets it toon
? Well, it will then all depend on the underlying code that processes environment variables: if the code iterates over the slice and gets the value from the first variable that matches the key, then we will use incorrect value.GO111MODULES
stuff better in the project README or/and inform the user with an info log about us setting it for the package load.The text was updated successfully, but these errors were encountered: