安装golang tour,提示错误

试图在自己机器上安装golang tour,出现了问题。

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

请教一下各位前辈如何解决。上网找了几天,没有找到答案。谢谢先~

系统环境是这样的:

export GOROOT=/usr/local/go
export GOPATH=/usr/local/GOPATH
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
export GO111MODULE=on

安装步骤:

~# go get golang.org/x/tour
go: finding golang.org/x/tour latest
go: finding golang.org/x/tools v0.0.0-20190312164927-7b79afddac43
go: finding golang.org/x/net v0.0.0-20190311183353-d8887717615a
go: finding golang.org/x/text v0.3.0
go: finding golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2
go: finding golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a
go: downloading golang.org/x/tour v0.0.0-20190611164551-1f1f3d2b450b
go: extracting golang.org/x/tour v0.0.0-20190611164551-1f1f3d2b450b
go: downloading golang.org/x/tools v0.0.0-20190312164927-7b79afddac43
go: extracting golang.org/x/tools v0.0.0-20190312164927-7b79afddac43
go: downloading golang.org/x/net v0.0.0-20190311183353-d8887717615a
go: extracting golang.org/x/net v0.0.0-20190311183353-d8887717615a

运行:

~# tour
2019/06/17 16:00:33 Couldn't find tour files: could not find go-tour content; check $GOROOT and $GOPATH

我想请教的问题:

  1. 这个错误怎么修正?
  2. 试图go mod download安装到其它目录(学习go mod),发现还是下载到$GOPATH/pkg中。正确的操作方法是什么呢?
已邀请:

keman1984 - 炳鑫

赞同来自: DennisMao

[~]# cat go.mod module golang.org/x/tour

go 1.11

require golang.org/x/tools v0.0.0-20190312164927-7b79afddac43 这个可能就是原因吧...

要回复问题请先登录注册