go.mod、DockerfileやCI設定に分散しがちなGoのバージョンをまとめて管理する ...

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on. →
Arthur
October 23, 2024

Annual Pro sale · Save $30

Have presentations of your own?

Share with private links, password protection, and more control over your work.

Transcript

43 slides
  1. go.modのgo directive > The go directive sets the minimum version

    of Go required to use this module. https://go.dev/ref/mod#go-mod-file-go ビルドできる最小の言語バージョンを定義する 15
  2. go.modのtoolchain directive > A toolchain directive declares a suggested Go

    toolchain to use with a module. https://go.dev/ref/mod#go-mod-file-toolchain 推奨されるGoのツールチェーンのバージョン (の下限)を定義する 16
  3. GitHub Actionsのsetup-go 39 - uses: actions/setup-go@v5 with: go-version-file: go.mod go

    1.21.0 toolchain go1.23.0 ① setup-goがgo directiveを見て1.21.0のGoバイナリを準備する ② build時にtoolchain directiveを見て1.23.0をダウンロードする 動くには動くけど、毎回DLしてて勿体無い
  4. GitHub Actionsのsetup-go 40 - uses: actions/setup-go@v5 with: go-version: stable 宣言したツールチェーンと同じか、それより新しいものを許容する場

    合には、とりあえずここはstableでよい。古い分にはtoolchainが自 動でダウンロードされる

More Decks by Arthur

Other Decks in Programming