{"record":{"id":"45c2716ae1db258b","repo":"golangci/golangci-lint","slug":"clone-golangci-lint-w","errorCode":null,"errorMessage":"clone golangci-lint: %w","messagePattern":"clone golangci-lint: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/commands/internal/builder.go","lineNumber":48,"sourceCode":"}\n\n// NewBuilder creates a new Builder.\nfunc NewBuilder(logger logutils.Log, cfg *Configuration, root string) *Builder {\n\treturn &Builder{\n\t\tcfg:  cfg,\n\t\tlog:  logger,\n\t\troot: root,\n\t\trepo: filepath.Join(root, \"golangci-lint\"),\n\t}\n}\n\n// Build builds the custom binary.\nfunc (b Builder) Build(ctx context.Context) error {\n\tb.log.Infof(\"Cloning golangci-lint repository\")\n\n\terr := b.clone(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"clone golangci-lint: %w\", err)\n\t}\n\n\tb.log.Infof(\"Adding plugin imports\")\n\n\terr = b.updatePluginsFile()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"update plugin file: %w\", err)\n\t}\n\n\tb.log.Infof(\"Adding replace directives\")\n\n\terr = b.addToGoMod(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"add to go.mod: %w\", err)\n\t}\n\n\tb.log.Infof(\"Running go mod tidy\")\n","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/golangci/golangci-lint/blob/ed7a235d2d771152056fdc142a9855567c5796a9/pkg/commands/internal/builder.go#L30-L66","documentation":"Builder.Build (used by `golangci-lint custom`) starts by cloning the golangci-lint repository at the configured version into a temp directory. A clone failure is wrapped as \"clone golangci-lint: %w\" — typically a git/network/clone-target problem, before any plugin or build steps run.","triggerScenarios":"Running `golangci-lint custom` when b.clone(ctx) fails: invalid or nonexistent version tag, unreachable github.com, missing git binary, proxy/firewall blocking, or shallow-clone/SSH auth issues.","commonSituations":"Specifying a version that doesn't exist in .custom-gcl.yml; corporate proxy or offline environment; git not installed in CI image; SSH-only git config when HTTPS is required.","solutions":["Read the wrapped cause for the underlying git error (auth, DNS, tag not found).","Verify the version exists: git ls-remote --tags https://github.com/golangci/golangci-lint.","Ensure git is installed and network/proxy (HTTP(S)_PROXY) allows github.com access.","If behind a proxy, configure go env GOPROXY and git insteadOf/credentials appropriately."],"exampleFix":"// before (.custom-gcl.yml)\nversion: master-unknown\n// after\nversion: v1.61.0  # existing tag\n// plus ensure git present: which git","handlingStrategy":"validation","validationCode":"if _, err := exec.LookPath(\"git\"); err != nil { return fmt.Errorf(\"git not installed\") }\n// network + tag check before building the custom binary\nif err := exec.Command(\"git\", \"ls-remote\", \"--exit-code\",\n  \"https://github.com/golangci/golangci-lint\", \"refs/tags/\"+version).Run(); err != nil {\n  return fmt.Errorf(\"cannot reach repo or tag %s missing\", version)\n}","typeGuard":null,"tryCatchPattern":"if err := customCmd.Run(); err != nil {\n  if strings.Contains(err.Error(), \"clone golangci-lint\") {\n    log.Fatalf(\"clone failed, check git/network/version: %v\", errors.Unwrap(err))\n  }\n  return err\n}","preventionTips":["Verify the version tag exists before building (git ls-remote).","Install git in CI images and configure proxy env vars where needed.","Prefer HTTPS URLs unless SSH keys are correctly configured.","Cache the clone/GOPATH in CI to reduce network flakiness."],"tags":["golangci-lint","git","network","custom-binary"],"backgroundTag":"git-clone-failed","analyzedSha":"ed7a235d2d771152056fdc142a9855567c5796a9","analyzedAt":"2026-09-02T18:47:33.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}