Avatar ·

How to install the latest version of Go (Golang) on Ubuntu 22.04 LTS?

Hello, colleagues! I'm a beginner Go developer and I've switched to Ubuntu 22.04. I'm trying to install Go, but through the standard apt package manager, a very old version 1.18 gets installed. I need the current version — 1.22 or 1.23, since I'm writing microservices using modern features (e.g., generics and new packages from the standard library). Here's what I'm doing:
sudo apt update
sudo apt install golang-go
After this, `go version` shows `go1.18.1 linux/amd64`. This is unacceptable, as many modern libraries require version 1.21+. I've tried adding PPAs from the internet, but they often become outdated or don't work. Please advise a reliable way to install the latest version of Go on Ubuntu, preferably with the ability to automatically update. I would also like