英文:
I can't install golang and godoc at the same time on Ubuntu
问题
我使用sudo apt-get install golang
安装了Golang。然后我可以使用go
命令。但是没有godoc
命令。我在网上找到了解决方法,可以使用sudo apt-get install golang-go.tools
来安装godoc。当我这样做时,我可以使用godoc
命令,但是go
命令不再起作用。我该如何同时让它们都正常工作?
英文:
I installed golang using sudo apt-get install golang
. Then I can use the go
command. But there is no godoc command. I found online I can use sudo apt-get install golang-go.tools
to install godoc. When I do that I can use the godoc
command but the go
command doesn't work anymore. How can I make them both work on the same time?
答案1
得分: 1
好的,我会为你翻译以下内容:
首先,我的建议是尝试移除golang-go.tools
包,并尝试使用go get golang.org/x/tools/godoc
命令,看看是否有效。
除此之外,提供更多详细信息会有所帮助。你在运行go
命令时遇到了哪些错误?
英文:
Well, my first suggestion is to try removing the golang-go.tools
package, and try go get golang.org/x/tools/godoc
; see if that works.
Beyond that, adding more details would help. What error(s) are you getting when you try to run the go
command now?
答案2
得分: 0
不要使用apt-get
安装golang
。
首先卸载golang:
apt-get purge golang*
从https://golang.org/dl/下载编译好的go存档文件:
wget https://storage.googleapis.com/golang/go1.7.3.linux-amd64.tar.gz
tar -xvf go1.6.linux-amd64.tar.gz
mv go /usr/local
您可能需要设置Go路径。然后可以测试您的安装。
export PATH=$PATH:/usr/local/go/bin
go version
现在应该可以使用godoc
了。
英文:
Don't install golang
by apt-get
.
First uninstall golang
apt-get purge golang*
Download compiled go archive from https://golang.org/dl/
wget https://storage.googleapis.com/golang/go1.7.3.linux-amd64.tar.gz
tar -xvf go1.6.linux-amd64.tar.gz
mv go /usr/local
You may need to set Go Paths. Then you can test your install.
export PATH=$PATH:/usr/local/go/bin
go version
godoc
should be usable now.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论