golangci/golangci-lint · error
build process: %w
Error message
build process: %w
What it means
The custom binary builder (runE of the 'custom' command) clones golangci-lint and compiles it with plugins. If internal.NewBuilder(...).Build() returns any error, it is wrapped as "build process: %w". It means one of the build steps (clone, plugin file update, go.mod edits, go build) failed while creating the custom golangci-lint binary.
Source
Thrown at pkg/commands/custom.go:103
func (c *customCommand) runE(cmd *cobra.Command, _ []string) error {
tmp, err := os.MkdirTemp(os.TempDir(), "custom-gcl")
if err != nil {
return fmt.Errorf("create temporary directory: %w", err)
}
defer func() {
if os.Getenv(envKeepTempFiles) != "" {
log.Printf("WARN: The env var %s has been detected: the temporary directory is preserved: %s", envKeepTempFiles, tmp)
return
}
_ = os.RemoveAll(tmp)
}()
err = internal.NewBuilder(c.log, c.cfg, tmp).Build(cmd.Context())
if err != nil {
return fmt.Errorf("build process: %w", err)
}
return nil
}
View on GitHub (pinned to ed7a235d2d)
Solutions
- Read the wrapped cause at the end of the message and fix that specific step (clone, plugin file, go.mod, or compile error).
- Check network/proxy settings and that the golangci-lint version specified exists and can be cloned.
- Verify each plugin entry in .custom-gcl.yml points to a valid module path/version and the Go toolchain is installed and up to date.
- Re-run with debug logging to see which build phase failed.
Example fix
// before version: v1.61.0 // typo/nonexistent tag // after version: v1.61.0 // verify tag exists: git ls-remote https://github.com/golangci/golangci-lint vX.Y.Z
Defensive patterns
Strategy: validation
Validate before calling
if _, err := exec.LookPath("git"); err != nil { return fmt.Errorf("git required: %w", err) }
if _, err := exec.LookPath("go"); err != nil { return fmt.Errorf("go toolchain required: %w", err) }
// verify version exists before invoking the custom build
if err := exec.Command("git", "ls-remote", "--exit-code",
"https://github.com/golangci/golangci-lint", "refs/tags/"+version).Run(); err != nil {
return fmt.Errorf("version %s does not exist", version)
} Try / catch
if err := customCmd.Run(); err != nil {
var buildErr *BuildError
if errors.As(err, &buildErr) { log.Fatalf("custom build failed: %v", errors.Unwrap(err)) }
} Prevention
- Pin an existing golangci-lint tag in .custom-gcl.yml and verify it with git ls-remote.
- Ensure git and a recent Go toolchain are installed in your build/CI environment.
- Set HTTP(S)_PROXY/HTTPS_PROXY and GOPROXY correctly behind corporate firewalls.
- Run with debug logging the first time to catch which build phase fails.
When it happens
Trigger: Running `golangci-lint custom` where Builder.Build fails: git clone of the target golangci-lint version fails, updatePluginsFile or addToGoMod fails, or the final `go build` of the custom binary errors.
Common situations: Bad/unknown golangci-lint version in .custom-gcl.yml; no network access or corporate proxy blocking GitHub; invalid plugin repo URLs; Go toolchain missing or too old for the target version; build flags referencing nonexistent packages.
Related errors
- clone golangci-lint: %w
- update plugin file: %w
- context loading failed: %w
- the configuration contains invalid elements
- unsupported configuration format
AI-assisted analysis of golangci/golangci-lint@ed7a235d2d (2026-09-02).
Data as JSON: /api/errors/f9de56cb7b409527.
Report an issue: GitHub.