@@ -12,8 +12,9 @@ import (
1212
1313var SetupLogErrorCheck = & analysis.Analyzer {
1414 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 ,
1718}
1819
1920func runSetupLogErrorCheck (pass * analysis.Pass ) (interface {}, error ) {
@@ -72,7 +73,7 @@ func runSetupLogErrorCheck(pass *analysis.Pass) (interface{}, error) {
7273
7374 pass .Reportf (callExpr .Pos (),
7475 "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 " +
7677 "\U0001F41B **What is wrong?**\n %s\n \n " +
7778 "\U0001F4A1 **How to solve? Return the error, i.e.:**\n logger.Error(%s, %s, \" key\" , value)\n \n " ,
7879 sourceLine , suggestedError , suggestedMessage )
0 commit comments