为什么在go env中GOPATH变成了”OPATH”?

huangapple go评论85阅读模式
英文:

Why GOPATH turned to "OPATH in go env

问题

你好!以下是你要翻译的内容:

localhost:~ jjw$ cat .bash_profile
export GOPATH="/Users/jjw/gocode"
localhost:~ jjw$
localhost:~ jjw$ source .bash_profile
localhost:~ jjw$ go env
GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
"OPATH="/Users/jjw/gocode 
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-    arguments -fmessage-length=0 -fno-common"
CXX="clang++"
CGO_ENABLED="1"

我对于为什么GOPATH变成了"OPATH"感到困惑。

英文:
localhost:~ jjw$ cat .bash_profile
export GOPATH="/Users/jjw/gocode"
localhost:~ jjw$
localhost:~ jjw$ source .bash_profile
localhost:~ jjw$ go env
GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
"OPATH="/Users/jjw/gocode 
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-    arguments -fmessage-length=0 -fno-common"
CXX="clang++"
CGO_ENABLED="1"

I am confused as to why GOPATH turned to "OPATH.

答案1

得分: 3

我猜你的导出GOPATH行以\r\n(Windows风格)而不是\n(Unix风格)结尾。

\r是回车字符,它只是重置列号。这就是为什么“字符显示在G字符的顶部。

你可以通过在.bash_profile文件上使用od或hexdump命令来检查这一点。

英文:

I suppose your export GOPATH line terminates by \r\n (a la Windows) instead of just \n (a la Unix).

The \r is the carriage return character. It just resets the column number. So that's why the " character is displayed on top of the G character.

You can check this point by using the od or hexdump command on your .bash_profile file.

huangapple
  • 本文由 发表于 2015年4月23日 21:22:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/29824802.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定