dongxingji3882 2019-09-14 18:18
浏览 91
已采纳

当未定义$ GOPATH时,如何查找安装有'go get -u'的Go软件包?

I'm following the gRPC Quickstart tutorial for Go, https://grpc.io/docs/quickstart/go/, and have installed gRPC using the command

go get -u google.golang.org/grpc

I actually haven't defined a GOPATH environment variable:

> echo $GOPATH

which, as I understand it, means that it defaults to ~/go, or in my case /Users/kurt/go.

At the next step, I'd like to build the example by doing

cd $GOPATH/src/google.golang.org/grpc/examples/helloworld

However, I find that the directory doesn't exist, and there is also no google.golang.org directory in /Users/kurt/go/src:

~/g/src> ls *google*
fish: No matches for wildcard '*google*'. See `help expand`.
ls *google*
   ^

Should the package not be located here? That's what I understand from Where does go get install packages?.

  • 写回答

3条回答 默认 最新

  • doudeng1870 2019-09-15 18:47
    关注

    Using Go Modules, you can find 'go get' downloaded files at:

    ~/go/pkg/mod/cache/download
    

    However, it should be treated like an immutable copy of the source code.

    If you want a mutable copy of the source code, you should clone the repository:

    git clone https://github.com/grpc/grpc-go
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 mmocr的训练错误,结果全为0
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀