Skip to content

Enable unparam linter; fix/mute existing warnings #3302

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

Merged
merged 13 commits into from
Nov 30, 2021

Conversation

kolyshkin
Copy link
Contributor

It looks like unparam is a meaningful linter.

All commits except one are small and easy to review.

It is not used since commit e918d02.

Signed-off-by: Kir Kolyshkin <[email protected]>
Since commit ff5075c it is no longer used.

Signed-off-by: Kir Kolyshkin <[email protected]>
It was never used.

Signed-off-by: Kir Kolyshkin <[email protected]>
Since commit eebdb64 this function never returns any error.

Signed-off-by: Kir Kolyshkin <[email protected]>
It is not used since commit 00a0ecf.

Signed-off-by: Kir Kolyshkin <[email protected]>
It is not and was not ever used.

Signed-off-by: Kir Kolyshkin <[email protected]>
This function never returned anything other than nil, and its return
value is discarded since it is only called from defer.

Signed-off-by: Kir Kolyshkin <[email protected]>
This function has a return value for consistency, let it stay.

Signed-off-by: Kir Kolyshkin <[email protected]>
Those were never used (ctx was added by the initial commit, and
error was added by commit 25fd4a6).

Signed-off-by: Kir Kolyshkin <[email protected]>
It never returns any error, so let's drop it (in case it needs to be
re-added, it is easy to do so).

Signed-off-by: Kir Kolyshkin <[email protected]>
Ignore the following warning:

> libcontainer/cgroups/fs/blkio_test.go:167:78: `appendBlkioStatEntry` - `minor` always receives `0` (unparam)
> func appendBlkioStatEntry(blkioStatEntries *[]cgroups.BlkioStatEntry, major, minor, value uint64, op string) {

Signed-off-by: Kir Kolyshkin <[email protected]>
It is not and was never ever used.

Signed-off-by: Kir Kolyshkin <[email protected]>
@kolyshkin kolyshkin changed the title Fix unparam linter warnings, enable unparam linter Enable unparam linter; fix/mute existing warnings Nov 30, 2021
@kolyshkin kolyshkin requested a review from thaJeztah November 30, 2021 19:58
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

if err := inheritStdio(process); err != nil {
return nil, err
}
inheritStdio(process)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm tempted to (for a follow-up) just get rid of the inheritStdio() altogether, and just inline the code here;

Suggested change
inheritStdio(process)
process.Stdin = os.Stdin
process.Stdout = os.Stdout
process.Stderr = os.Stderr

@thaJeztah thaJeztah merged commit 0c0ec3f into opencontainers:master Nov 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants