Switch to golangci-lint v2, fix or suppress new warnings#12
Merged
kolyshkin merged 5 commits intoopencontainers:mainfrom Apr 24, 2025
Merged
Switch to golangci-lint v2, fix or suppress new warnings#12kolyshkin merged 5 commits intoopencontainers:mainfrom
kolyshkin merged 5 commits intoopencontainers:mainfrom
Conversation
AkihiroSuda
approved these changes
Apr 8, 2025
1. Use tagged switch on value, fixing the staticcheck linter warning:
> fs2/memory.go:22:2: QF1002: could use tagged switch on value (staticcheck)
> switch {
> ^
2. Eliminate named return, and return early, simplifying the code.
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Ignore this:
> fs2/memory.go:57:7: QF1001: could apply De Morgan's law (staticcheck)
> if !(errors.Is(err, os.ErrNotExist) && (swapStr == "max" || swapStr == "0")) {
> ^
Because it its current form, the if condition corresponds to the
preceding comment.
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Since commit 8a90b8b the emulator is private, but it is still referred to as Emulator. Fix this. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Both revive and staticcheck complains like this:
> devices/devices_emulator.go:239:20: ST1016: methods on the same type should have the same receiver name (seen 1x "source", 8x "e") (staticcheck)
> func (e *emulator) Apply(rule devices.Rule) error {
> ^
What they mean to point to is this line:
> func (source *emulator) Transition(target *emulator) ([]*devices.Rule, error) {
In here, "source" does actually make sense, but instead of suppressing
these warnings, let's just give up and rename the receiver, and
introduce a source variable instead.
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
The new configs were initially created by golangci-lint migrate, then tailored to simplify and minify. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Contributor
Author
|
I need a second review/LGTM here. @dims @odinuge @haircommander alas you're not opencontainers.org members so can't be included into the above alias. Nevertheless PTAL |
odinuge
approved these changes
Apr 24, 2025
Member
|
feel free to merge, unless you prefer reviews from the others mentioned |
Contributor
|
LGTM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please see individual commits for details.
(This is based on and includes #10;will rebase if #10 will be merged first).