{"record":{"id":"6f09b8417ac8329a","repo":"golang/go","slug":"relative-pattern-not-allowed-in-govcs-q","errorCode":null,"errorMessage":"relative pattern not allowed in GOVCS: %q","messagePattern":"relative pattern not allowed in GOVCS: %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/go/internal/vcs/vcs.go","lineNumber":652,"sourceCode":"\thave := make(map[string]string)\n\tfor item := range strings.SplitSeq(s, \",\") {\n\t\titem = strings.TrimSpace(item)\n\t\tif item == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"empty entry in GOVCS\")\n\t\t}\n\t\tpattern, list, found := strings.Cut(item, \":\")\n\t\tif !found {\n\t\t\treturn nil, fmt.Errorf(\"malformed entry in GOVCS (missing colon): %q\", item)\n\t\t}\n\t\tpattern, list = strings.TrimSpace(pattern), strings.TrimSpace(list)\n\t\tif pattern == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"empty pattern in GOVCS: %q\", item)\n\t\t}\n\t\tif list == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"empty VCS list in GOVCS: %q\", item)\n\t\t}\n\t\tif search.IsRelativePath(pattern) {\n\t\t\treturn nil, fmt.Errorf(\"relative pattern not allowed in GOVCS: %q\", pattern)\n\t\t}\n\t\tif old := have[pattern]; old != \"\" {\n\t\t\treturn nil, fmt.Errorf(\"unreachable pattern in GOVCS: %q after %q\", item, old)\n\t\t}\n\t\thave[pattern] = item\n\t\tallowed := strings.Split(list, \"|\")\n\t\tfor i, a := range allowed {\n\t\t\ta = strings.TrimSpace(a)\n\t\t\tif a == \"\" {\n\t\t\t\treturn nil, fmt.Errorf(\"empty VCS name in GOVCS: %q\", item)\n\t\t\t}\n\t\t\tallowed[i] = a\n\t\t}\n\t\tcfg = append(cfg, govcsRule{pattern, allowed})\n\t}\n\treturn cfg, nil\n}\n","sourceCodeStart":634,"sourceCodeEnd":670,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/go/internal/vcs/vcs.go#L634-L670","documentation":"GOVCS patterns must be module path prefixes (e.g., 'github.com', 'public'), not filesystem-relative paths. If search.IsRelativePath(pattern) is true (pattern starts with ./, ../, or similar), the entry is rejected.","triggerScenarios":"A GOVCS entry uses a relative filesystem path as a pattern: `GOVCS=./local:git` or `GOVCS=../shared:fossil`.","commonSituations":"Confusing GOVCS import-path patterns with filesystem paths; assuming GOVCS matches local directory paths.","solutions":["Use module path patterns, not filesystem paths — GOVCS matches against import paths, not directories","For a module hosted at example.com/myproj, use `GOVCS=example.com:git`","Use the built-in 'public' and 'private' pattern keywords for broad rules"],"exampleFix":"# before: relative filesystem path (wrong)\nexport GOVCS=\"./myproject:git\"\n\n# after: module import path pattern\nexport GOVCS=\"example.com:git\"","handlingStrategy":"validation","validationCode":"# Validate GOVCS patterns are not relative paths\nGOVCS_VAL=\"${GOVCS:-}\"\nif [ -n \"$GOVCS_VAL\" ]; then\n  echo \"$GOVCS_VAL\" | tr ',' '\\n' | while IFS= read -r entry; do\n    entry=\"$(echo \"$entry\" | xargs)\"\n    pattern=\"$(echo \"${entry%%:*}\" | xargs)\"\n    case \"$pattern\" in\n      ./*|../*|.\\\\*|..\\\\*) echo \"ERROR: relative pattern not allowed in GOVCS: $pattern\" ;;\n    esac\n  done\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["GOVCS patterns match import paths, not filesystem paths — never use ./ or ../","Use domain-based patterns like 'github.com' or built-in 'public'/'private' keywords","Validate GOVCS configuration before deploying"],"tags":["vcs","config","govcs","validation"],"backgroundTag":null,"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T12:31:55.035Z"}