-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Misc linter nits #2695
Merged
Merged
Misc linter nits #2695
Conversation
This file contains 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
kolyshkin
force-pushed
the
linter-nits
branch
from
December 1, 2020 03:29
d57e912
to
ff6896a
Compare
thaJeztah
previously approved these changes
Dec 1, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
left questions w.r.t. the Windows changes (change doesn't really affect current code, but perhaps we need a tracking issue for it and/or remove the windows code altogether?)
kolyshkin
force-pushed
the
linter-nits
branch
2 times, most recently
from
December 3, 2020 03:58
fd78c12
to
bada950
Compare
TBBle
previously approved these changes
Dec 3, 2020
AkihiroSuda
previously approved these changes
Dec 3, 2020
> libcontainer/cgroups/utils.go:282:4: SA4006: this value of `paths` is never used (staticcheck) > paths = make(map[string]string) Signed-off-by: Kir Kolyshkin <[email protected]>
Commit 4415446 introduces this function which is never used. Remove it. This fixes > libcontainer/container_linux.go:1813:26: func `(*linuxContainer).deleteState` is unused (unused) Signed-off-by: Kir Kolyshkin <[email protected]>
This fixes the following warnings: > libcontainer/integration/exec_test.go:369:18: S1030: should use stdout.String() instead of string(stdout.Bytes()) (gosimple) > outputStatus := string(stdout.Bytes()) > ^ > libcontainer/integration/exec_test.go:422:18: S1030: should use stdout.String() instead of string(stdout.Bytes()) (gosimple) > outputStatus := string(stdout.Bytes()) > ^ > libcontainer/integration/exec_test.go:486:18: S1030: should use stdout.String() instead of string(stdout.Bytes()) (gosimple) > outputGroups := string(stdout.Bytes()) > ^ > libcontainer/integration/execin_test.go:191:18: S1030: should use stdout.String() instead of string(stdout.Bytes()) (gosimple) > outputGroups := string(stdout.Bytes()) > ^ > libcontainer/integration/execin_test.go:474:9: S1030: should use stdout.String() instead of string(stdout.Bytes()) (gosimple) > out := string(stdout.Bytes()) > ^ Signed-off-by: Kir Kolyshkin <[email protected]>
... use the one from unix instead. Coincidentally, this fixes this warning from gosimple linter: > libcontainer/integration/exec_test.go:448:2: S1021: should merge variable declaration with assignment on next line (gosimple) > var netAdminBit uint > ^ Signed-off-by: Kir Kolyshkin <[email protected]>
> libcontainer/container_linux.go:683:2: S1021: should merge variable declaration with assignment on next line (gosimple) > var t criurpc.CriuReqType > ^ Signed-off-by: Kir Kolyshkin <[email protected]>
> libcontainer/container_linux.go:768:2: S1017: should replace this `if` statement with an unconditional `strings.TrimPrefix` (gosimple) > if strings.HasPrefix(mountDest, c.config.Rootfs) { > ^ > libcontainer/container_linux.go:1150:2: S1017: should replace this `if` statement with an unconditional `strings.TrimPrefix` (gosimple) > if strings.HasPrefix(mountDest, c.config.Rootfs) { > ^ Signed-off-by: Kir Kolyshkin <[email protected]>
> libcontainer/intelrdt/monitoring.go:24:2: SA5001: should check returned error before deferring file.Close() (staticcheck) > defer file.Close() > ^ Signed-off-by: Kir Kolyshkin <[email protected]>
kolyshkin
force-pushed
the
linter-nits
branch
from
December 3, 2020 18:24
bada950
to
9792929
Compare
As per conversation in moby/moby#41746 (comment), I separated out the windows part of this to #2700. |
mrunalp
approved these changes
Dec 4, 2020
AkihiroSuda
approved these changes
Dec 4, 2020
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.
This fixes some sensible linter warnings, and silence a few that do not make much sense. Please see individual commits for details.
With this other PRs (#2694, #2696, #2700), we are down to 3 warnings (plus a lot of
errcheck
ones which are to be addressed separately):The protobuf one needs coordinated changes in go-criu (cc @adrianreber).
The ebfp one is related to cilium/ebpf@5727d65 and probably cilium/ebpf#110
Related to #2627