go module_error ai_generated true

go: module github.com/example/[email protected] requires go 1.22, but your Go version is go1.20

ID: go/unsupported-go-version-in-module

Also available as: JSON · Markdown · 中文
80%Fix Rate
89%Confidence
0Evidence
2025-04-10First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
1.20 active
1.21 active
1.22 active

Root Cause

A module dependency requires a newer version of Go than what is installed.

generic

中文

模块依赖需要比已安装版本更新的 Go 版本。

Workarounds

  1. 95% success Upgrade your Go installation to a compatible version.
    Download and install Go 1.22 or later from golang.org/dl/.
  2. 80% success Use a older version of the module that supports your Go version.
    Run 'go list -m -versions github.com/example/mod' and downgrade to an older version in go.mod.

Dead Ends

Common approaches that don't work:

  1. Setting GOTOOLCHAIN to force using an older version. 70% fail

    GOTOOLCHAIN only affects the toolchain selection; if the module requires a newer Go, it won't compile.

  2. Removing the go directive from the dependency's go.mod. 100% fail

    You cannot modify third-party modules; the requirement is enforced.