{"record":{"id":"d7c467c9e4afd9e3","repo":"golang/go","slug":"no-scheme","errorCode":null,"errorMessage":"no scheme","messagePattern":"no scheme","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/go/internal/vcs/vcs.go","lineNumber":1108,"sourceCode":"\t}\n\tif subdir[0] == '/' {\n\t\treturn errors.New(\"leading slash\")\n\t}\n\tif subdir[0] == '-' {\n\t\treturn errors.New(\"leading hyphen\")\n\t}\n\treturn nil\n}\n\n// validateRepoRoot returns an error if repoRoot does not seem to be\n// a valid URL with scheme.\nfunc validateRepoRoot(repoRoot string) error {\n\turl, err := urlpkg.Parse(repoRoot)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif url.Scheme == \"\" {\n\t\treturn errors.New(\"no scheme\")\n\t}\n\tif url.Scheme == \"file\" {\n\t\treturn errors.New(\"file scheme disallowed\")\n\t}\n\treturn nil\n}\n\nvar fetchGroup singleflight.Group\nvar (\n\tfetchCacheMu sync.Mutex\n\tfetchCache   = map[string]fetchResult{} // key is metaImportsForPrefix's importPrefix\n)\n\n// metaImportsForPrefix takes a package's root import path as declared in a <meta> tag\n// and returns its HTML discovery URL and the parsed metaImport lines\n// found on the page.\n//\n// The importPath is of the form \"golang.org/x/tools\".","sourceCodeStart":1090,"sourceCodeEnd":1126,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/go/internal/vcs/vcs.go#L1090-L1126","documentation":"validateRepoRoot parses the repo root as a URL and requires a non-empty scheme. An empty scheme means the value looks like a bare path/host rather than a fully-qualified URL (e.g. `github.com/u/r` instead of `https://github.com/u/r`).","triggerScenarios":"A vanity meta tag or VCS path config supplies a repo root with no scheme.","commonSituations":"Hand-authored `<meta name=\"go-import\">` tags missing the protocol; legacy vanity servers.","solutions":["Add a scheme (https, git, ssh) to the repo root in the meta tag.","Fix the vanity server to emit fully-qualified URLs."],"exampleFix":"<!-- before -->\n<meta name=\"go-import\" content=\"example.com git github.com/u/r\">\n<!-- after -->\n<meta name=\"go-import\" content=\"example.com git https://github.com/u/r\">","handlingStrategy":"validation","validationCode":"// Ensure vanity repo roots carry a scheme.\nfunc validRepoRoot(root string) error {\n    u, err := url.Parse(root)\n    if err != nil { return err }\n    if u.Scheme == \"\" { return errors.New(\"repo root needs a scheme (https/git/ssh)\") }\n    return nil\n}","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Always include the scheme in go-import repo roots.","Validate meta-tag output from vanity servers with `go get -v`."],"tags":["vcs","validation","vanity-import","scheme"],"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T06:17:24.410Z"}