Skip to content

Ubuntu24.04 へ asdf で golang をインストールする

以前に Ubuntu 24.04 へ asdf をインストールして言語 / ツールのバージョンを管理する というメモを書きました。 今回は Ubuntu 24.04 へ asdf へ golang をインストールする手順をメモしておきます。

検証環境

以下の環境で検証しました。

  • macOS Sonoma 14.2.1
  • M1

インストール

golang を asdf でインストールします。 インストール可能な golang のバージョンは asdf list all golang で確認出来ます。

1
2
3
asdf plugin add golang
asdf install golang 1.21.5
asdf global golang 1.21.5

golang 1.21.5 がインストールされました。

1
2
# go version
go version go1.21.5 linux/amd64

参考

golang のヘルプ

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# go --help
Go is a tool for managing Go source code.

Usage:

 go <command> [arguments]

The commands are:

 bug         start a bug report
 build       compile packages and dependencies
 clean       remove object files and cached files
 doc         show documentation for package or symbol
 env         print Go environment information
 fix         update packages to use new APIs
 fmt         gofmt (reformat) package sources
 generate    generate Go files by processing source
 get         add dependencies to current module and install them
 install     compile and install packages and dependencies
 list        list packages or modules
 mod         module maintenance
 work        workspace maintenance
 run         compile and run Go program
 test        test packages
 tool        run specified go tool
 version     print Go version
 vet         report likely mistakes in packages

Use "go help <command>" for more information about a command.

Additional help topics:

 buildconstraint build constraints
 buildmode       build modes
 c               calling between Go and C
 cache           build and test caching
 environment     environment variables
 filetype        file types
 go.mod          the go.mod file
 gopath          GOPATH environment variable
 gopath-get      legacy GOPATH go get
 goproxy         module proxy protocol
 importpath      import path syntax
 modules         modules, module versions, and more
 module-get      module-aware go get
 module-auth     module authentication using go.sum
 packages        package lists and patterns
 private         configuration for downloading non-public code
 testflag        testing flags
 testfunc        testing functions
 vcs             controlling version control with GOVCS

Use "go help <topic>" for more information about that topic.