@@ -12,8 +12,9 @@ import (
12
12
13
13
var SetupLogErrorCheck = & analysis.Analyzer {
14
14
Name : "setuplogerrorcheck" ,
15
- Doc : "Detects improper usage of logger.Error() calls, ensuring the first argument is a non-nil error." ,
16
- Run : runSetupLogErrorCheck ,
15
+ Doc : "Detects and reports improper usages of logger.Error() calls to enforce good practices " +
16
+ "and prevent silent failures." ,
17
+ Run : runSetupLogErrorCheck ,
17
18
}
18
19
19
20
func runSetupLogErrorCheck (pass * analysis.Pass ) (interface {}, error ) {
@@ -72,7 +73,7 @@ func runSetupLogErrorCheck(pass *analysis.Pass) (interface{}, error) {
72
73
73
74
pass .Reportf (callExpr .Pos (),
74
75
"Incorrect usage of 'logger.Error(nil, ...)'. The first argument must be a non-nil 'error'. " +
75
- "Passing 'nil' results in silent failures , making debugging harder.\n \n " +
76
+ "Passing 'nil' may hide error details , making debugging harder.\n \n " +
76
77
"\U0001F41B **What is wrong?**\n %s\n \n " +
77
78
"\U0001F4A1 **How to solve? Return the error, i.e.:**\n logger.Error(%s, %s, \" key\" , value)\n \n " ,
78
79
sourceLine , suggestedError , suggestedMessage )
0 commit comments