golangci/golangci-lint · error

missing reportData argument in constructor

Error message

missing reportData argument in constructor

What it means

Defensive constructor check in NewPrinter: the reportData parameter (*report.Data) was nil. It indicates a wiring bug in the caller — the collected report data was never created or passed — not a user configuration problem.

Source

Thrown at pkg/printers/printer.go:50

	reportData *report.Data
	basePath   string

	log logutils.Log

	stdOut io.Writer
	stdErr io.Writer
}

// NewPrinter creates a new Printer.
func NewPrinter(log logutils.Log, cfg *config.Formats, reportData *report.Data, basePath string) (*Printer, error) {
	if log == nil {
		return nil, errors.New("missing log argument in constructor")
	}
	if cfg == nil {
		return nil, errors.New("missing config argument in constructor")
	}
	if reportData == nil {
		return nil, errors.New("missing reportData argument in constructor")
	}

	return &Printer{
		cfg:        cfg,
		reportData: reportData,
		basePath:   basePath,
		log:        log,
		stdOut:     logutils.StdOut,
		stdErr:     logutils.StdErr,
	}, nil
}

// Print prints issues based on the formats defined.
//
//nolint:gocyclo,funlen // the complexity is related to the number of formats.
func (c *Printer) Print(issues []*result.Issue) error {
	if c.cfg.IsEmpty() {
		c.cfg.Text.Path = outputStdOut

View on GitHub (pinned to ed7a235d2d)

Solutions

  1. Ensure the caller creates a *report.Data and passes it to NewPrinter
  2. Review run-command wiring that assembles printers and report data
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/printers/printer.go:50 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/c32e98f5a221e5c1. Report an issue: GitHub.