First Golang install on Linux

All the references that I’ve found for Getting started with Golang are old. Is there a current getting started with Golang that someone can point me to?

Thanks.

I found this “Go, from the beginning” last published 2022. This should be current enough.

I guess you are started by now but in case you want to learn more in-depth with lots of background-information on how Go works, check this thread, especially my own recommendation: Please Recommend Some Fun Paperback Introductions to Go - #10 by duckduck

1 Like

In general - unless you’ve got specific reasons to do otherwise - you should just use your distro’s package manager.

BTW: I’ve packaged 1.20 for Debian/Devuan: GitHub - metux/deb-pkg: Toolkit for building apt/yum completely from sources
Look at the GH workflows for prebuilt debs/apt-repo, if you don’t wanna run it yourself.

(didn’t have the time to package latest release)

I’ve always been curious about the different workflows used by different distro’s. So you’re well versed in debian packaging?

I’m into nixOS and nixpkgs although definitely not yet on the packaging-level.

Since my daily driver is macOS, I found it easiest to just download the installer from https://go.dev/dl/ but I can also just nix-shell -p go.

On my nixOS-playbox I’ve been experimenting with installing different versions of Go at once.
If nixOS you can nix-shell -p go which will start a new shell with that package installed.

This is what an example shell-session looks like so you can see how I installed different versions side by side, with only one original version coming from the package manager (nixOSpkgs):

[nix-shell:~]$ go version
go version go1.19.9 linux/amd64

nix-shell:~]$ ls ~/go/bin
go1.15.7  go1.19.10  go1.20.9  go1.21.1  go1.21.2

[nix-shell:~]$ export PATH=~/go/bin:$PATH

[nix-shell:~]$ go1.21.2 version
go version go1.21.2 linux/amd64

[nix-shell:~]$ go install golang.org/dl/go1.21.3@latest
go: downloading golang.org/dl v0.0.0-20231010164639-b8ab22880620

[nix-shell:~]$ ls ~/go/bin
go1.15.7  go1.19.10  go1.20.9  go1.21.1  go1.21.2  go1.21.3

[nix-shell:~]$ go1.21.3 version
go1.21.3: not downloaded. Run 'go1.21.3 download' to install to ~/sdk/go1.21.3

[nix-shell:~]$ go1.21.3 download
Downloaded   0.0% (   16384 / 66641773 bytes) ...
Downloaded  13.4% ( 8945600 / 66641773 bytes) ...
Downloaded  55.7% (37142256 / 66641773 bytes) ...
Downloaded  97.7% (65109520 / 66641773 bytes) ...
Downloaded 100.0% (66641773 / 66641773 bytes)
Unpacking ~/sdk/go1.21.3/go1.21.3.linux-amd64.tar.gz ...
Success. You may now run 'go1.21.3'

[nix-shell:~]$ go1.21.3 version
go version go1.21.3 linux/amd64

[nix-shell:~]$ du -sh ~/sdk/go1.21.3
308M	~/sdk/go1.21.3

I’m not sure since which version go started to support this way of managing different versions.

BTW: Somehow on this nixOS-box all the older versions don’t work for me. Running go1.20.9 version returns nothing (an empty line).

Anyway, this thread could maybe turn into an interesting discussion about packaging go-related software or the go-tool itself on different Linux/BSD-distro-flavors?

What do you mean by old? The question is if they are good, I think that old is not too relevant. If your question is about installing Go on Linux you can find the right answer on the official page which is good enough because the procedure for installing Go is the same for years.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.