2
0

【Golang】Invalid go version '**': must match format ** の対処法

Last updated at Posted at 2023-12-09

はじめに

こちらは、go.modのパースに関するエラーです。
コマンド以外ではgo.modを触っていなかったために対処法が分からず苦労したので、バグレポートのような感じで残しておきます。

原因と対処法

原因は、go.mod内で記述するgoのバージョン指定方法に誤りがあるためでした。

go.mod
module hoge

go 1.21.3 // ここが原因(バージョン指定方法ミス)

require (
	...
)

そのため、以下の記述方法に変更します。

go.mod
module hoge

go 1.21 // 変更

require (
	...
)

そうすると、エラーが発生せずに動かすことができました。

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