golang tour Couldn‘t find tour files

Couldn't find tour files: could not find go-tour content; check $GOROOT and $GOPATH

go get golang.org/x/tour

备注:go 代理

https://goproxy.cn/

https://goproxy.io/

https://search.gocenter.io/

在 go 官方文档上,安装 tour 项目。安装完以后,tour 会被安装到 GOPATH bin 文件夹下,运行的时候报错。

在网上搜索发现 tour 的 main 函数在 local.go 文件中。

我也不太了解这个项目是怎么找路径的,解决方法是在 tour 源码根目录下运行 tour ,就不报错了

go get 安装 tour 下载到了这里 /Users/hg26972/go/pkg/mod/golang.org/x/tour@v0.0.0-20201007071457-6f9d4ff994b1,可以把它拷到其他路径的。

然后就可以用浏览器查看这个文档了

例如这样启动 tour:

命令行 cd 到 tour 源码

/Users/hg26972/go/src/goland.org/x/tour

然后执行:

~/go/bin/tour 或 $/GOPATH/bin/tour

 


版权声明:本文为qq_38002009原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。