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条)

报告相同问题?

悬赏问题

  • ¥65 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用