{"record":{"id":"fa03ac229f4ce1d3","repo":"golangci/golangci-lint","slug":"clean-runtime-version-w","errorCode":null,"errorMessage":"clean runtime version: %w","messagePattern":"clean runtime version: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/goutil/version.go","lineNumber":16,"sourceCode":"package goutil\n\nimport (\n\t\"fmt\"\n\t\"go/version\"\n\t\"regexp\"\n\t\"runtime\"\n\t\"strings\"\n\n\thcversion \"github.com/hashicorp/go-version\"\n)\n\nfunc CheckGoVersion(goVersion string) error {\n\trv, err := CleanRuntimeVersion()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"clean runtime version: %w\", err)\n\t}\n\n\tlangVersion := version.Lang(rv)\n\n\truntimeVersion, err := hcversion.NewVersion(strings.TrimPrefix(langVersion, \"go\"))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttargetedVersion, err := hcversion.NewVersion(TrimGoVersion(goVersion))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif runtimeVersion.LessThan(targetedVersion) {\n\t\treturn fmt.Errorf(\"the Go language version (%s) used to build golangci-lint is lower than the targeted Go version (%s)\",\n\t\t\tlangVersion, goVersion)\n\t}","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/golangci/golangci-lint/blob/ed7a235d2d771152056fdc142a9855567c5796a9/pkg/goutil/version.go#L1-L34","documentation":"CheckGoVersion compares the Go language version golangci-lint was built with against the targeted version from the analyzed module's go.mod. Before comparing, it calls CleanRuntimeVersion, which extracts the go1.x token from runtime.Version(). This error wraps a CleanRuntimeVersion failure: the running binary's version string contains no 'go1.' token, typically a devel/tip build or a nonstandard toolchain. The underlying message is 'invalid Go runtime version: <string>'.","triggerScenarios":"Calling CheckGoVersion (via Load or an anonymous wrapper) with a golangci-lint binary whose runtime.Version() yields no 'go1.' token — e.g. gotip/devel builds like 'devel go1.24-e705a2d ...' in unparseable forms, or heavily forked toolchains.","commonSituations":"Using a gotip or source-built devel golangci-lint binary; running a binary built with a modified toolchain (custom crypto experiments, forked Go) against a module that requires a version check.","solutions":["Use an official golangci-lint release built with a stable Go toolchain instead of a devel/tip build.","If building from source, build with a released Go version so runtime.Version() contains a parseable 'go1.' token.","Check the wrapped message after 'clean runtime version:' to identify the offending runtime string and toolchain.","Align your go.mod go directive with a version <= the build toolchain's language version to avoid version-check paths.","Report nonstandard version strings from forked toolchains upstream if they should be supported."],"exampleFix":"// before\n$ gotip build -o golangci-lint ./cmd/golangci-lint  // runtime.Version() = \"devel ...\" -> invalid\n// after\n$ go1.23 build -o golangci-lint ./cmd/golangci-lint  // stable toolchain, parseable version","handlingStrategy":"validation","validationCode":"// Detect an unparseable runtime version before calling CheckGoVersion\nfunc runtimeVersionIsClean() bool {\n\tfor _, part := range strings.Fields(runtime.Version()) {\n\t\tif strings.HasPrefix(part, \"go1.\") {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n// only use stable-toolchain builds if this returns false","typeGuard":null,"tryCatchPattern":"if err := goutil.CheckGoVersion(targetedVersion); err != nil {\n\tif strings.Contains(err.Error(), \"clean runtime version\") {\n\t\treturn fmt.Errorf(\"golangci-lint built with nonstandard Go toolchain (%s); rebuild with a stable release: %w\", runtime.Version(), err)\n\t}\n\treturn err\n}","preventionTips":["Build golangci-lint only with released Go toolchains, not gotip/devel.","Prefer official release binaries or the install script over local forks.","Run `golangci-lint --version` / `go version` on the binary before wiring it into CI.","If using a forked toolchain, verify runtime.Version() contains a 'go1.' token."],"tags":["golang","version-check","toolchain","runtime"],"backgroundTag":"invalid-go-runtime-version","analyzedSha":"ed7a235d2d771152056fdc142a9855567c5796a9","analyzedAt":"2026-09-02T18:47:33.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}