LoginSignup
2
0

More than 3 years have passed since last update.

Goの1.16で missing go.sum entry for module ... to add: ...と出るときの対処法

Posted at

起きた事

とあるアプリケーションを起動しようと、コンテナをbuildしていたらこんなエラーに遭遇しました。

container.PNG

go build ...のタイミングで落ちているようで。
どうやらgo.sumにモジュールが載っていないことが原因の模様です。

原因

https://golang.org/doc/go1.16#go-command
ここにこんな一文が。

Build commands like go build and go test no longer modify go.mod and go.sum by default.

要するに、コード中でimportしていたら今まではgo.sumとかを変更してくれていたのが、デフォではしてくれなくなったみたいです。
全部ちゃんと書いてね☆

対応

go mod tidy

をビルド前に挟めば、今まで通り勝手に更新してくれるようになります。

自戒

ちゃんとリリースノートは読もう!

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0