dopgv00024 2019-01-25 21:17
浏览 1931
已采纳

尽管设置了GOPATH,但是echo $ GOPATH不返回任何内容

I have this weird issue.

When I run go env, I get the following:

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/ethanc/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/ethanc/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/ethanc/marketstore/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build154822748=/tmp/go-build -gno-record-gcc-switches"

But when, I run echo $GOPATH, I get an empty new line. This happens for all other GO environment values as well when I try to echo them out: Empty GOPATH result

This doesn't make sense because when I try to print out other path variables like echo $HOME, I get the correct value:

/home/ethanc

Does anyone have any idea why when I echo my GOPATH, only a new line is returned?

  • 写回答

2条回答 默认 最新

  • douhuxi4145 2019-01-25 21:21
    关注

    This is the default value for GOPATH.

    Since it's never set, go will use it's reasonable default.

    Main consquence of course is all your go projects sharing this $GOPATH.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥200 csgo2的viewmatrix值是否还有别的获取方式
  • ¥15 Stable Diffusion,用Ebsynth utility在视频选帧图重绘,第一步报错,蒙版和帧图没法生成,怎么处理啊
  • ¥15 请把下列每一行代码完整地读懂并注释出来
  • ¥15 pycharm运行main文件,显示没有conda环境
  • ¥15 寻找公式识别开发,自动识别整页文档、图像公式的软件
  • ¥15 为什么eclipse不能再下载了?
  • ¥15 编辑cmake lists 明明写了project项目名,但是还是报错怎么回事
  • ¥15 关于#计算机视觉#的问题:求一份高质量桥梁多病害数据集
  • ¥15 特定网页无法访问,已排除网页问题
  • ¥50 如何将脑的图像投影到颅骨上