2014-12-14 22:47 浏览 174


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

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答 默认 最新

  • 已采纳
    dounao4179 dounao4179 2014-12-15 20:42

    Perhaps you should check your environment variables, especially it's length.

    If your environment variables hit the maximum size, windows can't access the env variables properly so it leads to your error message.

    Further information:
    Environment Variables
    What happens with Path System Variable is too long?

    点赞 评论 复制链接分享