{"record":{"id":"c32e98f5a221e5c1","repo":"golangci/golangci-lint","slug":"missing-reportdata-argument-in-constructor","errorCode":null,"errorMessage":"missing reportData argument in constructor","messagePattern":"missing reportData argument in constructor","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/printers/printer.go","lineNumber":50,"sourceCode":"\treportData *report.Data\n\tbasePath   string\n\n\tlog logutils.Log\n\n\tstdOut io.Writer\n\tstdErr io.Writer\n}\n\n// NewPrinter creates a new Printer.\nfunc NewPrinter(log logutils.Log, cfg *config.Formats, reportData *report.Data, basePath string) (*Printer, error) {\n\tif log == nil {\n\t\treturn nil, errors.New(\"missing log argument in constructor\")\n\t}\n\tif cfg == nil {\n\t\treturn nil, errors.New(\"missing config argument in constructor\")\n\t}\n\tif reportData == nil {\n\t\treturn nil, errors.New(\"missing reportData argument in constructor\")\n\t}\n\n\treturn &Printer{\n\t\tcfg:        cfg,\n\t\treportData: reportData,\n\t\tbasePath:   basePath,\n\t\tlog:        log,\n\t\tstdOut:     logutils.StdOut,\n\t\tstdErr:     logutils.StdErr,\n\t}, nil\n}\n\n// Print prints issues based on the formats defined.\n//\n//nolint:gocyclo,funlen // the complexity is related to the number of formats.\nfunc (c *Printer) Print(issues []*result.Issue) error {\n\tif c.cfg.IsEmpty() {\n\t\tc.cfg.Text.Path = outputStdOut","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/golangci/golangci-lint/blob/ed7a235d2d771152056fdc142a9855567c5796a9/pkg/printers/printer.go#L32-L68","documentation":"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.","triggerScenarios":"Thrown at pkg/printers/printer.go:50 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the caller creates a *report.Data and passes it to NewPrinter","Review run-command wiring that assembles printers and report data"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"ed7a235d2d771152056fdc142a9855567c5796a9","analyzedAt":"2026-09-02T18:47:33.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}