-
Notifications
You must be signed in to change notification settings - Fork 148
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
fix linter errors #188
fix linter errors #188
Conversation
Just noticed that you are running `golangci-lint run --out-format=github-actions --enable=golint,bodyclose,gosec,whitespace` as part of the CI. I don't necessarily agree with errors being ignored, but I wanted to just get the lint to pass. List of lint issues this PR resolves. ``` ::error file=cmd/sriov/main.go,line=115,col=17::Error return value of `ipam.ExecDel` is not checked (errcheck) ::error file=cmd/sriov/main.go,line=170,col=28::Error return value of `utils.CleanCachedNetConf` is not checked (errcheck) ::error file=cmd/sriov/main.go,line=96,col=18::Error return value of `sm.ReleaseVF` is not checked (errcheck) ::error file=pkg/config/config.go,line=90::unnecessary leading newline (whitespace) ::error file=pkg/config/config_suite_test.go,line=28,col=2::S1021: should merge variable declaration with assignment on next line (gosimple) ::error file=pkg/sriov/sriov.go,line=210::unnecessary leading newline (whitespace) ::error file=pkg/sriov/sriov.go,line=36,col=2::`lm` is unused (structcheck) ::error file=pkg/sriov/sriov.go,line=220::unnecessary leading newline (whitespace) ::error file=pkg/sriov/sriov.go,line=271::unnecessary leading newline (whitespace) ::error file=pkg/sriov/sriov.go,line=380::unnecessary leading newline (whitespace) ::error file=pkg/sriov/sriov_suite_test.go,line=28,col=2::S1021: should merge variable declaration with assignment on next line (gosimple) ::error file=pkg/sriov/sriov_test.go,line=213,col=6::type `mockPciUtils` is unused (unused) ::error file=pkg/sriov/sriov_test.go,line=218,col=25::func `(*mockPciUtils).getPciAddress` is unused (unused) ::error file=pkg/sriov/sriov_test.go,line=239,col=25::func `(*mockPciUtils).getSriovNumVfs` is unused (unused) ::error file=pkg/sriov/sriov_test.go,line=260,col=25::func `(*mockPciUtils).getVFLinkNamesFromVFID` is unused (unused) ::error file=pkg/utils/testing.go,line=76,col=16::ineffectual assignment to err (ineffassign) ::error file=pkg/utils/testing.go,line=92::unnecessary leading newline (whitespace) ::error file=pkg/utils/testing.go,line=94,col=13::G306: Expect WriteFile permissions to be 0600 or less (gosec) ::error file=pkg/utils/utils.go,line=130,col=12::ineffectual assignment to err (ineffassign) ::error file=pkg/utils/utils.go,line=132,col=11::ineffectual assignment to err (ineffassign) ::error file=pkg/utils/utils_suite_test.go,line=22,col=2::S1021: should merge variable declaration with assignment on next line (gosimple) ```
Let me know if you would like me to fix the ignored errors. I was just trying to do as little changes as possible for this PR. |
@@ -209,76 +209,6 @@ func (_m *MockNetlinkManager) LinkSetVfState(_a0 netlink.Link, _a1 int, _a2 uint | |||
return r0 | |||
} | |||
|
|||
// mockPciUtils is an autogenerated mock type for the mockPciUtils type |
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.
It seems we are not really using this mock in sriov tests, I presume it is safe to delete.
@martinkennelly @adrianchiris wdyt?
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.
Sorry I did not realize that mockery created that file. So I removed this change for now.
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.
I see its not being used so should be deleted.
Sorry I did not notice that mockery created that file. So removing my changes.
final issue is : this is not being used today. and if its needed in the future it should go to its own mock file to avoid mixing with the actual (non auto generated) tests. |
This reverts commit ff9cd75.
I removed it again. For some reason I can not run the tests locally. So I was not able to confirm the tests are working but I am sure CI will tell us if it creates a problem. If you do redo the mock in the future could you put the information and command on creating the mock file in a generate.go file? |
yes autogenerated files usually have comments informing about the tool thats used to generate (e.g mockery) |
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 ! thank you for your contribution
commit messages are abit off, as they should just contain informative information about the changes performed. |
golangci-lint which runs as part of CI reports errors. This commit fixes those errors.
golangci-lint which runs as part of CI reports errors. This commit fixes those errors.
Just noticed that you are running
golangci-lint run --out-format=github-actions --enable=golint,bodyclose,gosec,whitespace
as part of the CI.I don't necessarily agree with errors being ignored, but I wanted to just get the lint to pass.
List of lint issues this PR resolves.