安裝golang tour,提示錯誤

keman1984發表於2019-06-17

試圖在自己機器上安裝 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 中。正確的操作方法是什麼呢?
更多原創文章乾貨分享,請關注公眾號
  • 安裝golang tour,提示錯誤
  • 加微信實戰群請加微信(註明:實戰群):gocnio

相關文章