duankui1532
2017-06-13 19:54
浏览 196
已采纳

设置后Go环境变量保持不变

I start learning Go programming by watching online tutorials. I use Windows command prompt. However, after I typed set GOOS = darwin then used go env to print environment variables, GOOS was not set to GOOS=darwin but still GOOS=windows as default.


Here is what I got. Could someone tell me where I went wrong such that I cannot make change on GOOS?

C:\GoPath\src\palindrome>set GOOS = darwin

C:\GoPath\src\palindrome>go env
set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

  • duandao7704 2017-06-13 20:37
    最佳回答

    "Any extra spaces around either the variable name or the string, will not be ignored, SET is not forgiving of extra spaces like many other scripting languages."

    Change set GOOS = darwin to set GOOS=darwin - i.e., the same format you see in the output of go env.

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题