如何获得离线的Golang编程教程?

huangapple go评论76阅读模式
英文:

How to get golang programming tour offline

问题

我想要离线下载go-tour,我该怎么做?我尝试使用以下代码进行下载,但是没有成功:

go get code.google.com/p/go-tour/gotour

英文:

I wanted to download go-tour offline
how can i get it?
I have tried to use code

  go get code.google.com/p/go-tour/gotour

but it doesn't work.

答案1

得分: 9

如果你说“它不起作用”是指你收到错误消息:package code.google.com/p/go-tour/gotour: cannot download, $GOPATH not set. For more details see: go help gopath,那么你需要设置GOPATH,然后使用go get命令获取所需的包。

无论如何,这是使GoTour工作的完整解决方案,假设你已经安装了Go。

mkdir go_tour && cd go_tour
export GOPATH=`pwd`
go get code.google.com/p/go-tour/gotour
./bin/gotour
英文:

If by saying "it doesn't work" you mean that you get error message: package code.google.com/p/go-tour/gotour: cannot download, $GOPATH not set. For more details see: go help gopath, then you need to setup GOPATH and then go get desired package.

Anyway, here is the complete solution to get GoTour working, assuming you already have Go installed.

mkdir go_tour && cd go_tour
export GOPATH=`pwd`
go get code.google.com/p/go-tour/gotour
./bin/gotour

答案2

得分: -1

"it doesn't work"的具体问题是什么?

$ go get code.google.com/p/go-tour/gotour

$ gotour

2014/03/22 20:02:53 从/Users/matt/.go/src/code.google.com/p/go-tour提供内容
2014/03/22 20:02:53 应该会打开一个浏览器窗口。如果没有,请访问http://127.0.0.1:3999

对我来说没有问题。请确保你的$GOPATH正确设置并在你的shell中导出。检查go env的输出以确认。

英文:

Can you expand on "it doesn't work"?

  $ go get code.google.com/p/go-tour/gotour

  $ gotour

2014/03/22 20:02:53 Serving content from /Users/matt/.go/src/code.google.com/p/go-tour
2014/03/22 20:02:53 A browser window should open. If not, please visit http://127.0.0.1:3999

No problems for me. Make sure your $GOPATH is set correctly and exported in your shell. Check the output of go env to confirm.

huangapple
  • 本文由 发表于 2014年3月22日 19:38:51
  • 转载请务必保留本文链接:https://go.coder-hub.com/22577091.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定