diff --git a/pkg/golinters/errcheck.go b/pkg/golinters/errcheck.go index 2d9a4fc4cd05..0499c54ad337 100644 --- a/pkg/golinters/errcheck.go +++ b/pkg/golinters/errcheck.go @@ -66,9 +66,14 @@ func NewErrcheck() *goanalysis.Linter { for i, err := range errcheckIssues.UncheckedErrors { var text string if err.FuncName != "" { + code := err.SelectorName + if err.SelectorName == "" { + code = err.FuncName + } + text = fmt.Sprintf( "Error return value of %s is not checked", - formatCode(err.SelectorName, lintCtx.Cfg), + formatCode(code, lintCtx.Cfg), ) } else { text = "Error return value is not checked"