2014-12-14 22:47


  • windows

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

I set up everything properly and created the enviroment variables

GOARCH = amd64
GOOS = linux

My problem occurs whenever I try to switch between platforms by changing GOOS to either linux or amd64. I use Console 2 to manage my standart cmd, cygwin console and git console. After changing GOOS with:

xset GOOS=amd64

different consoles show different values for the variable e.g:

//git bash
echo $GOOS
echo %GOOS%

This happens even after restarting all consoles. Additionally I am suddenly unable to access parts of my system! Trying to access my "Advanced System settings" in my System properties returns now a warning:

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

which sounds to my like win7 suddenly can't handle its own environment variables anymore.

This also means that I can't change the variables through the windows GUI anymore.

On top of all that the "go" command is no longer bound and I am unable to build anything with go.

My only solution this far is to restart my entire system every time I change a variable. After a restart the variable is changed an everything works fine until I want to change GOOS again.

I would be very happy about any kind of input, I am new to go and assume that I am missing something obvious.

Thanks in advance

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享