Golang版本更新

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

Golang version update

问题

我搜索了一种更新Golang的方法,但是各种不同的答案让我感到困惑。我尝试了一些方法,但都没有成功。我在WSL 2上使用的是Ubuntu 20.04。

这篇文章似乎是一个合理的答案,但是它并没有起作用。有没有办法自动更新Go呢?

英文:

I have searched for a way to update golang, and I got confused with all the different answers. I tried some but none worked for me. I'm using ubuntu 20.04 on wsl 2.

This article seemed like a reasonable answer, but it didn't work. Is there any way to automate go update?

答案1

得分: 2

你可以在这里下载最新的Linux Go工具:https://go.dev/dl/,并按照这些安装说明进行安装:https://go.dev/doc/install(选择Linux选项卡)。

在Ubuntu上的另一种选择是添加这个PPA,其中包含稳定的Go后端:https://launchpad.net/~longsleep/+archive/ubuntu/golang-backports,然后通过使用apt install golang来安装Go。这将与系统范围的更新兼容。apt update将在将Go版本后端到PPA后看到任何新版本,并且apt upgrade将安装它们。

请参阅此页面https://github.com/zchee/golang-wiki/blob/master/Ubuntu.md以获取更多选项,例如Snap或getgo。

英文:

You can download latest Go tooling for Linux here: https://go.dev/dl/ and follow these installation instructions https://go.dev/doc/install (select Linux tab).

Alternative on Ubuntu is to add this PPA with stable Go backports: https://launchpad.net/~longsleep/+archive/ubuntu/golang-backports and then install Go by simply using apt install golang. This will play nice with system wide updates. apt update will see any new versions of Go once they are backported to PPA and apt upgrade will install them.

See this page https://github.com/zchee/golang-wiki/blob/master/Ubuntu.md for more options such as Snap or getgo.

答案2

得分: 0

你可以直接访问官方的Golang网站,下载安装程序,然后前往/usr/local目录删除之前的Golang安装。

一旦你删除了之前的安装,现在将新的安装程序复制/粘贴到/usr/local目录中,重新启动系统,Go将会被更新。

英文:

what you can do is simply head over to the official golang website and download the setup, afterwards remove the previous golang installation by heading to /usr/local and removing go dir.

once you have removed the previous installation now go and copy/paste your new setup in /usr/local, reboot system and go will be updated

huangapple
  • 本文由 发表于 2022年12月23日 19:07:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/74898953.html
匿名

发表评论

匿名网友

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

确定