chore: enable and fixes rules from gocritic - #246
Conversation
|
Overall LGTM, left some nits. |
28b23df to
1f2af12
Compare
kolyshkin
left a comment
There was a problem hiding this comment.
LGTM; @thaJeztah PTAL
|
Oh! You need to rebase, because go1.27 is not "stable", so GolangCi-lint needed updating |
thaJeztah
left a comment
There was a problem hiding this comment.
needs a rebase (see above), but LGTM after the list is updated to the ones we actually hit; #246 (comment)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
| //nolint:errcheck // Ignore error in tests | ||
| Unmount(dir) |
There was a problem hiding this comment.
Perhaps just explicitly ignore the error, then we don't need a nolint comment;
| //nolint:errcheck // Ignore error in tests | |
| Unmount(dir) | |
| _ = Unmount(dir) |
There was a problem hiding this comment.
I also don't think moving this to a utility is correct; it changes semantics because it now unmounts immediately? If we want to keep that behavior, then we could do something like;
var toUnMount []string
t.Cleanup(func() {
for _ m := range toUnmount {
_ = Unmount(m)
}
})(either t.Cleanup or defer, depending on go version supported, but I'd be fine bumping to a slightly newer version if needed)
There was a problem hiding this comment.
Possibly the utility of #253 could be used if it's modified to take a variadic strings.
|
|
||
| func mountTemporaryDirectory(t *testing.T, dir string) { | ||
| if err := Mount("tmpfs", dir, "tmpfs", ""); err != nil { | ||
| t.Fatal(err) | ||
| } | ||
| Unmount(dir) //nolint:errcheck // Ignore error in tests | ||
| } |
There was a problem hiding this comment.
Same here; we can also defer the unmount explicitly ignore errors here as well;
_ = Unmount(dir) //nolint:errcheck // Ignore error in testsIf the defer / cleanup wasn't relevant to the test, we can just inline it without the cleanup.
Enables all gocritic rules by default, then excludes the one non compliant then fix one rule per commit
Covers #245 gocritic part only