golangci/golangci-lint · error

build golangci-lint binary: %w

Error message

build golangci-lint binary: %w

What it means

Wrapping error in Builder.Build: the goBuild step ('go build' producing the custom golangci-lint binary) failed. Causes include compile errors in plugin sources, missing dependencies, a bad output target, or an unsupported Go toolchain. The underlying exec error is wrapped with %w.

Source

Thrown at pkg/commands/internal/builder.go:78

	err = b.addToGoMod(ctx)
	if err != nil {
		return fmt.Errorf("add to go.mod: %w", err)
	}

	b.log.Infof("Running go mod tidy")

	err = b.goModTidy(ctx)
	if err != nil {
		return fmt.Errorf("go mod tidy: %w", err)
	}

	b.log.Infof("Building golangci-lint binary")

	binaryName := b.getBinaryName()

	err = b.goBuild(ctx, binaryName)
	if err != nil {
		return fmt.Errorf("build golangci-lint binary: %w", err)
	}

	b.log.Infof("Moving golangci-lint binary")

	err = b.copyBinary(binaryName)
	if err != nil {
		return fmt.Errorf("move golangci-lint binary: %w", err)
	}

	return nil
}

func (b Builder) clone(ctx context.Context) error {
	//nolint:gosec // the variable is sanitized.
	cmd := exec.CommandContext(ctx,
		"git", "clone", "--branch", sanitizeVersion(b.cfg.Version),
		"--single-branch", "--depth", "1", "-c", "advice.detachedHead=false", "-q",
		"https://github.com/golangci/golangci-lint.git",

View on GitHub (pinned to ed7a235d2d)

Solutions

  1. Inspect the build output logged by the builder for compile errors
  2. Verify plugin code compiles against the target golangci-lint version
  3. Check the Go toolchain version and CGO settings
  4. Fix any reported plugin type errors (e.g. wrong New signature)
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at pkg/commands/internal/builder.go:78 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of golangci/golangci-lint@ed7a235d2d (2026-09-02). Data as JSON: /api/errors/30358e69c71ea2c0. Report an issue: GitHub.