Skip to content
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

lint: fix warnings from whitespace and gocritic, enable those #126

Merged
merged 2 commits into from
Oct 30, 2020

Conversation

kolyshkin
Copy link
Collaborator

@kolyshkin kolyshkin commented Oct 29, 2020

1. Vertical whitespace nits.

Found by whitespace linter:

go-selinux/label/label_selinux.go:60: unnecessary trailing newline (whitespace)

go-selinux/label/label_selinux_test.go:160: unnecessary trailing newline (whitespace)

go-selinux/selinux_linux_test.go:51: unnecessary trailing newline (whitespace)

Fix these, enable the linter.

2. Fix gocritic warnings, enable the linter

The warnings were:

go-selinux/label/label_selinux.go:30:66: captLocal: `Err' should not be capitalized (gocritic)
func InitLabels(options []string) (plabel string, mlabel string, Err error) {
                                                                 ^
go-selinux/selinux_linux.go:831:3: assignOp: replace `ORD = ORD - TIER` with `ORD -= TIER` (gocritic)
                ORD = ORD - TIER
                ^
go-selinux/selinux_linux.go:835:2: assignOp: replace `ORD = ORD + TIER` with `ORD += TIER` (gocritic)
        ORD = ORD + TIER
        ^
go-selinux/selinux_linux.go:853:10: elseif: can replace 'else {if cond {}}' with 'else if cond {}' (gocritic)
                } else {
                       ^

Found by whitespace linter:

> go-selinux/label/label_selinux.go:60: unnecessary trailing newline (whitespace)
>
> go-selinux/label/label_selinux_test.go:160: unnecessary trailing newline (whitespace)
>
> go-selinux/selinux_linux_test.go:51: unnecessary trailing newline (whitespace)

Fix these, enable the linter.

Signed-off-by: Kir Kolyshkin <[email protected]>
The warnings were:

```
go-selinux/label/label_selinux.go:30:66: captLocal: `Err' should not be capitalized (gocritic)
func InitLabels(options []string) (plabel string, mlabel string, Err error) {
                                                                 ^
go-selinux/selinux_linux.go:831:3: assignOp: replace `ORD = ORD - TIER` with `ORD -= TIER` (gocritic)
		ORD = ORD - TIER
		^
go-selinux/selinux_linux.go:835:2: assignOp: replace `ORD = ORD + TIER` with `ORD += TIER` (gocritic)
	ORD = ORD + TIER
	^
go-selinux/selinux_linux.go:853:10: elseif: can replace 'else {if cond {}}' with 'else if cond {}' (gocritic)
		} else {
		       ^
```

Signed-off-by: Kir Kolyshkin <[email protected]>
@kolyshkin kolyshkin changed the title Vertical whitespace nits. lint: fix warnings from whitespace and gocritic, enable those Oct 29, 2020
Copy link
Collaborator

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@rhatdan rhatdan left a comment

Choose a reason for hiding this comment

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

LGTM

@rhatdan rhatdan merged commit bca2471 into opencontainers:master Oct 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants