From f63a757b1e69bae52bc2f37d06be8f52c4fd2385 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 14 Sep 2024 01:00:17 +0900 Subject: [PATCH] cmd/ebitenmobile: bug fix: need toolchain for the temporary go.mod Updates #3086 --- cmd/ebitenmobile/gomobile.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/ebitenmobile/gomobile.go b/cmd/ebitenmobile/gomobile.go index 29ad52d55..ba22e737c 100644 --- a/cmd/ebitenmobile/gomobile.go +++ b/cmd/ebitenmobile/gomobile.go @@ -161,6 +161,12 @@ import ( return tmp, err } } + // runtime.Version() is the current executing Go version. For example, this is the version of the toolchain directive in go.mod. + // This might differ from the Go command version under the temporary directory. + // To avoid the version mismatch, set the toolchain explicitly (#3086). + if err := runGo("mod", "edit", "-toolchain="+runtime.Version()); err != nil { + return tmp, err + } if err := runGo("mod", "tidy"); err != nil { return tmp, err }