aboutsummaryrefslogtreecommitdiffstats
path: root/defererr_test.go
diff options
context:
space:
mode:
authorTeddy Wing2023-05-25 20:40:08 +0200
committerTeddy Wing2023-05-25 20:40:08 +0200
commit8bcef611f794272203e05e207259ac8d45d558fb (patch)
treeec633067878ab77f8b2c10ca438fd3fcb4582fc6 /defererr_test.go
parentc7ea2c3d8fd7d4536f04d060cc57307d15a340df (diff)
downloadgodefererr-8bcef611f794272203e05e207259ac8d45d558fb.tar.bz2
Report missing signature declaration with multiple return values
The previous message which reported when a function's return signature didn't declare an error variable didn't work for functions with multiple return values. I thought about extending it and coming up with generated variable names for the non-error types to be able to support automatic fixing, but this idea ended up being too complicated. Also, I didn't like the idea of an automated fixer coming up with generated variable names, because you'd need to manually rename them anyway. That kind of defeats the purpose of it being automated. Instead, change the diagnostic message to only refer to the error variable and recommend what the declared variable name should be based on the identifier the error was assigned to in the defer. Modify our multiple return value test functions according to this new approach.
Diffstat (limited to 'defererr_test.go')
0 files changed, 0 insertions, 0 deletions