Closed
Description
In this PR https://github.com/bombsimon/wsl/pull/37/files#diff-676fb336aa3ff093ebaa37c4293f1cd1R417 the issue was addressed just for Close
method, but in my opinion it applies to any method that is used in a similar way.
Here is an example usage of https://github.com/uber-go/automaxprocs package:
undoMaxProcs, err := maxprocs.Set()
if err != nil {
return fmt.Errorf("failed to set GOMAXPROCS, err: %w", err)
}
defer undoMaxProcs()
// The rest of the code goes here.
I think this code aligns nicely with Go-best-practices, but wsl
still complains about it:
main.go:72:2: only one cuddle assignment allowed before defer statement (wsl)
defer undoMaxProcs()
^
and wants to see it formatted this way:
undoMaxProcs, err := maxprocs.Set()
if err != nil {
return fmt.Errorf("failed to set GOMAXPROCS, err: %w", err)
}
defer undoMaxProcs()
// The rest of the code goes here.
which is less ideomatic in my opinion.
<
4113
/div>