From 8efe2cc2f9495b60b5a27f818af7d666651aee4d Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 21 May 2023 21:39:48 +0200 Subject: Report function signature declaration using variable name other than err I had previously hard-coded the variable name "err" as the recommended name declaration in the function signature for simplicity. Now, use the name assigned in the `defer` instead, which is more correct. --- defererr.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'defererr.go') diff --git a/defererr.go b/defererr.go index 96072be..f6167ae 100644 --- a/defererr.go +++ b/defererr.go @@ -334,8 +334,8 @@ func checkErrorAssignedInDefer( if !isErrorNameInReturnSignature { pass.Reportf( errorReturnField.Pos(), - "return signature should be '(err error)'", // TODO: Use name from ident.Name - // errorReturnField, + "return signature should be '(%s error)'", // TODO: Use name from ident.Name + ident, ) break -- cgit v1.2.3