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

Fixing some lint issues #2631

Merged
merged 1 commit into from
Oct 8, 2020
Merged

Conversation

knabben
Copy link
Contributor

@knabben knabben commented Oct 3, 2020

Fixing some issues from #2627

contrib/cmd/recvtty/recvtty.go:108:20: Error return value of console.ClearONLCR is not checked (errcheck)

libcontainer/cgroups/systemd/common.go:377:3: S1023: redundant return statement (gosimple)

libcontainer/configs/validate/validator.go:231:5: S1002: should omit comparison to bool constant, can be simplified to !symLink (gosimple)

libcontainer/container_linux.go:1531:2: S1006: should use for {} instead of for true {} (gosimple)

libcontainer/integration/checkpoint_test.go:238:2: SA4006: this value of process is never used (staticcheck)

libcontainer/integration/checkpoint_test.go:258:12: S1030: should use stdout.String() instead of string(stdout.Bytes()) (gosimple)

libcontainer/integration/exec_test.go:282:11: S1030: should use stdout.String() instead of string(stdout.Bytes()) (gosimple)

libcontainer/integration/exec_test.go:285:12: S1030: should use stdout2.String() instead of string(stdout2.Bytes()) (gosimple)

libcontainer/integration/exec_test.go:328:15: S1030: should use stdout.String() instead of string(stdout.Bytes()) (gosimple)

libcontainer/integration/exec_test.go:1504:21: S1030: should use stdout2.String() instead of string(stdout2.Bytes())
(gosimple)

libcontainer/nsenter/nsenter_test.go:229:2: S1023: redundant return statement (gosimple)

libcontainer/seccomp/config.go:65:29: S1002: should omit comparison to bool constant, can be simplified to ok (gosimple)

libcontainer/seccomp/config.go:73:28: S1002: should omit comparison to bool constant, can be simplified to ok (gosimple)

libcontainer/user/user_test.go:466:3: S1032: should use sort.Ints(...) instead of sort.Sort(sort.IntSlice(...)) (gosimple)

libcontainer/user/user_test.go:502:3: S1032: should use sort.Ints(...) instead of sort.Sort(sort.IntSlice(...)) (gosimple)

notify_socket.go:165:16: Error return value of client.Write is not checked (errcheck)

@@ -269,7 +269,6 @@ func RemovePaths(paths map[string]string) (err error) {
}
}
if len(paths) == 0 {
paths = make(map[string]string)
Copy link
Member

Choose a reason for hiding this comment

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

This needs to be kept #2628

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment on lines 108 to 109
err = console.ClearONLCR(c.Fd())
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
err = console.ClearONLCR(c.Fd())
if err != nil {
if err := console.ClearONLCR(c.Fd()); if err != nil {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggestion applied in the squashed commit.

kolyshkin
kolyshkin previously approved these changes Oct 5, 2020
Copy link
Contributor

@kolyshkin kolyshkin left a comment

Choose a reason for hiding this comment

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

LGTM

notify_socket.go Outdated
client.Write([]byte(newPid + "\n"))
_, err := client.Write([]byte(newPid + "\n"))
if err != nil {
return nil
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you mean

Suggested change
return nil
return err

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes.

@knabben knabben force-pushed the fix-some-lints branch 2 times, most recently from 4c78fbf to 8abbcfe Compare October 6, 2020 16:23
@knabben
Copy link
Contributor Author

knabben commented Oct 6, 2020

@kolyshkin @AkihiroSuda PTAL

@@ -294,8 +294,11 @@ func getIntelRdtRoot() (string, error) {
}

func isIntelRdtMounted() bool {
_, err := getIntelRdtRoot()
return err == nil
if _, err := getIntelRdtRoot(); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

This hunk looks weird. This was just fixed in commit e8eb800 and it seems you're reverting the change by mistake.

Signed-off-by: Amim Knabben <[email protected]>
Copy link
Contributor

@kolyshkin kolyshkin left a comment

Choose a reason for hiding this comment

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

LGTM

@kolyshkin
Copy link
Contributor

@AkihiroSuda @mrunalp PTAL

@mrunalp mrunalp merged commit 10825f7 into opencontainers:master Oct 8, 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.

4 participants