golangci/golangci-lint · warning

no colons

Error message

no colons

What it means

parseErrorPosition expects a position string in 'file:line(:column)' form as produced by the go/packages driver. It splits on colons and throws 'no colons' when the string contains no colon at all, meaning it cannot even extract a file path/line pair. This happens while parsing package-level error output from analysis runs.

Source

Thrown at pkg/goanalysis/pkgerrors/parse.go:32

func parseError(srcErr packages.Error) (*result.Issue, error) {
	pos, err := parseErrorPosition(srcErr.Pos)
	if err != nil {
		return nil, err
	}

	return &result.Issue{
		Pos:        *pos,
		Text:       srcErr.Msg,
		FromLinter: "typecheck",
	}, nil
}

func parseErrorPosition(pos string) (*token.Position, error) {
	// file:line(<optional>:column)
	parts := strings.Split(pos, ":")
	if len(parts) == 1 {
		return nil, errors.New("no colons")
	}

	file := parts[0]
	line, err := strconv.Atoi(parts[1])
	if err != nil {
		return nil, fmt.Errorf("can't parse line number %q: %w", parts[1], err)
	}

	var column int
	if len(parts) == 3 { // got column
		column, err = strconv.Atoi(parts[2])
		if err != nil {
			return nil, fmt.Errorf("failed to parse column from %q: %w", parts[2], err)
		}
	}

	return &token.Position{
		Filename: file,

View on GitHub (pinned to ed7a235d2d)

Solutions

  1. Ensure the failing package builds with 'go build ./...' and fix the underlying compile error
  2. Update golangci-lint and toolchain; newer drivers emit properly formatted positions
  3. Check for custom GOFLAGS/build tags or a custom packages driver producing malformed output
  4. Report the malformed error text upstream if it comes from a third-party tool
Defensive patterns

Strategy: try-catch

Validate before calling

if !strings.Contains(posStr, ":") {
    return fmt.Errorf("skipping malformed position %q", posStr)
}

Try / catch

if err != nil && strings.Contains(err.Error(), "no colons") {
    // fall back to treating the message as position-less and log it
}

Prevention

When it happens

Trigger: A package error message's position field lacks a colon, e.g. a plain message or a bare path 'somefile.go' instead of 'somefile.go:10'. Triggered via extractErrors/parseError when the driver emits non-standard error text.

Common situations: Broken or non-standard build tooling producing malformed go/packages output; custom package drivers or build systems emitting error lines without file:line; cgo or preprocessing errors reported without positional info.

Related errors


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