Can't cleanly set GOOS environment variable on win7

I am trying to use golangs cross compilation feature to compile on my machine (Windows 7) to switch between compilation for linux and amd64.

I configured everything correctly and created environment variables

GOARCH = amd64
GOOS = linux

      

My problem comes when I try to switch between platforms by changing GOOS to linux or amd64. I am using Console 2 to manage my default cmd, cygwin console and git console. After changing GOOS with:

xset GOOS=amd64

      

different consoles show different values ​​for the variable, for example:

//git bash
echo $GOOS
linux
//cmd
echo %GOOS%
amd64

      

This happens even after restarting all consoles. Also, I suddenly cannot access parts of my system! When trying to access my "Advanced System Preferences" in my system properties, a warning now appears:

"%windir%\system32\systempropertiesadvanced.exe" could not be found.

      

which sounds like my win7 unexpectedly can't handle native environment variables.

This also means that I can no longer change variables through the Windows GUI.

Also, the "go" command is no longer associated and I can't build anything with go.

My only solution is to reboot the whole system every time I change the variable. After restart, the variable changes, everything works fine until I want to change GOOS again.

I would be very happy about any input, I am a beginner to assume I am missing something obvious.

Thank you in advance

+3


source to share


1 answer


You might want to check your environment variables, especially the length.

If environment variables reach their maximum size, windows cannot access env variables normally, so they lead to your error message.



More information:
Environment Variables
What happens to a Path system variable that is too long?

+1


source







All Articles