{"record":{"id":"f20aa8e0dfa12a26","repo":"golang/go","slug":"s-has-non-s-module-path-q-s-at-revision-s","errorCode":null,"errorMessage":"%s has non-...%s module path %q%s at revision %s","messagePattern":"(.+?) has non-\\.\\.\\.(.+?) module path %q(.+?) at revision (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/go/internal/modfetch/coderepo.go","lineNumber":897,"sourceCode":"\t\t}\n\t}\n\n\t// Not v2/go.mod, so it's either go.mod or nothing. Which is it?\n\tif found1 {\n\t\t// Explicit go.mod with matching major version ok.\n\t\treturn rev, r.codeDir, gomod1, nil\n\t}\n\tif err1 == nil {\n\t\t// Explicit go.mod with non-matching major version disallowed.\n\t\tsuffix := \"\"\n\t\tif file2 != \"\" {\n\t\t\tsuffix = fmt.Sprintf(\" (and ...%s/go.mod does not exist)\", r.pathMajor)\n\t\t}\n\t\tif mpath1 == \"\" {\n\t\t\treturn \"\", \"\", nil, fmt.Errorf(\"%s is missing module path%s at revision %s\", file1, suffix, rev)\n\t\t}\n\t\tif r.pathMajor != \"\" { // \".v1\", \".v2\" for gopkg.in\n\t\t\treturn \"\", \"\", nil, fmt.Errorf(\"%s has non-...%s module path %q%s at revision %s\", file1, r.pathMajor, mpath1, suffix, rev)\n\t\t}\n\t\tif _, _, ok := module.SplitPathVersion(mpath1); !ok {\n\t\t\treturn \"\", \"\", nil, fmt.Errorf(\"%s has malformed module path %q%s at revision %s\", file1, mpath1, suffix, rev)\n\t\t}\n\t\treturn \"\", \"\", nil, fmt.Errorf(\"%s has post-%s module path %q%s at revision %s\", file1, semver.Major(version), mpath1, suffix, rev)\n\t}\n\n\tif r.codeDir == \"\" && (r.pathMajor == \"\" || strings.HasPrefix(r.pathMajor, \".\")) {\n\t\t// Implicit go.mod at root of repo OK for v0/v1 and for gopkg.in.\n\t\treturn rev, \"\", nil, nil\n\t}\n\n\t// Implicit go.mod below root of repo or at v2+ disallowed.\n\t// Be clear about possibility of using either location for v2+.\n\tif file2 != \"\" {\n\t\treturn \"\", \"\", nil, fmt.Errorf(\"missing %s/go.mod and ...%s/go.mod at revision %s\", r.pathPrefix, r.pathMajor, rev)\n\t}\n\treturn \"\", \"\", nil, fmt.Errorf(\"missing %s/go.mod at revision %s\", r.pathPrefix, rev)","sourceCodeStart":879,"sourceCodeEnd":915,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/go/internal/modfetch/coderepo.go#L879-L915","documentation":"findDir (coderepo.go:896-898). The root go.mod (file1) was read, declares a non-empty module path (mpath1), but pathMajor is non-empty (gopkg.in-style .vN suffix) and isMajor(mpath1, pathMajor) is false — the declared path's major-version suffix does not match the expected pathMajor. This branch is specific to gopkg.in-style major suffixes.","triggerScenarios":"Resolving a gopkg.in module (pathMajor like .v2) where the root go.mod declares a module path with a different major-version suffix (e.g. `module gopkg.in/foo.v3` while pathMajor expects .v2).","commonSituations":"gopkg.in modules whose go.mod was edited to point at a different major version than the import path; forked gopkg.in modules with mismatched suffixes; replace directives that mis-route gopkg.in paths.","solutions":["Align the module path in go.mod with the major version implied by the import path (e.g. for gopkg.in/foo.v2 the go.mod must say `module gopkg.in/foo.v2`).","If using replace, ensure the replacement path's major suffix matches.","Tag and re-resolve."],"exampleFix":"// before: go.mod\n//   module gopkg.in/foo.v3\n//\n// import path requested: gopkg.in/foo.v2\n\n// after: go.mod\n//   module gopkg.in/foo.v2","handlingStrategy":"validation","validationCode":"// For gopkg.in modules, the go.mod module path must match the import path's major.\n// bash:\n//   # import path gopkg.in/foo.v2 -> go.mod must say 'module gopkg.in/foo.v2'\n//   grep -H '^module ' go.mod\n// Cross-check:\n//   expected='gopkg.in/foo.v2'\n//   grep -qE \"^module ${expected}$\" go.mod || echo 'gopkg.in major mismatch'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["For gopkg.in modules, keep the .vN suffix identical in import path and go.mod.","When forking gopkg.in modules, update both the path and go.mod consistently.","Use `go mod tidy` to detect path/go.mod mismatches early."],"tags":["go-modules","go-mod","module-path","gopkg-in","major-version"],"backgroundTag":null,"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}