-
Notifications
You must be signed in to change notification settings - Fork 242
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
Enable golint with golangci-lint #825
Conversation
golint should now fail |
@dhellmann golint and govet now fail, not sure which options we want to keep |
I think all of the failures are things we should fix, so I'm OK with the set of rules that are enabled. The govet and golint jobs are running the same thing. Is govet enabled? We could probably drop one of the jobs if the same tool runs all of the tests in one job. |
yes, govet is included in golint |
1d67892
to
9c897ae
Compare
I will leave vet in makefile until govet job has been removed |
0ac721e
to
dc7f4e8
Compare
/test-integration |
/assign @dhellmann @hardys |
If the plan is to remove the govet from mandatory CI jobs, that can be done here https://github.com/metal3-io/project-infra/blob/ebe2d90c26bb3bf284fd34c2c171a82058249da6/prow/config/config.yaml#L252-L265 |
oh cool, thanks for pointing that out! |
It's included in golint in PR metal3-io/baremetal-operator#825
It's included in golint in PR metal3-io/baremetal-operator#825
What's with this |
@dtantsur it's unfortunately a valid lint error: we never really ran golint here that's why now we need to make these changes |
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.
One nit, but I'm not sure it really matters.
Thanks for working on this!
/approve
@@ -118,7 +112,7 @@ demo: generate lint manifests ## Run in demo mode | |||
go run -ldflags $(LDFLAGS) ./main.go -namespace=$(RUN_NAMESPACE) -dev -demo-mode | |||
|
|||
.PHONY: run-test-mode | |||
run-test-mode: generate fmt vet manifests ## Run against the configured Kubernetes cluster in ~/.kube/config | |||
run-test-mode: generate fmt-check lint manifests ## Run against the configured Kubernetes cluster in ~/.kube/config |
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 think this was using fmt
instead of fmt-check
so that code would be fixed before being passed to the compiler.
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 think fmt-check is correct as it's using the gofmt.sh script under /hack
fmt was just an alias for lint
vet is also an alias, but we will remove it later to not break the current jobs
/test-integration |
oh, now there are merge conflicts |
Most linters are disabled by default when using golangci-lint, we need to explicitely enable them if we want them to run. This change enables the basic golint support. For more info please check https://golangci-lint.run/usage/quick-start Also remove useless or duplicated entries from Makefile.
/test-integration |
/assign @asalkeld |
/approve Let's get this in so we don't regress the lint job and have to keep fixing issues in this PR. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dhellmann, elfosardo The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@dhellmann not sure why this is "Not mergeable", CI seems ok now :/ |
There are some issues with the upstream Prow instance. @maelk @kashifest @zaneb is it safe for me to merge this PR by hand? |
OK for me. By the way since tide is still working, we tested IPAM repo with enabling Travis to do a the tests and making prow optional and tide was able to merge it. We configured Travis test as required now. I have a PR to do the same for CAPM3 and Dev-Env. Shall I do the same for BMO? metal3-io/project-infra#179. You have to configure Travis tests as required. |
It sounds like that's probably a good idea, but we should talk about it somewhere that more community members will be able to offer their opinion. Maybe the mailing list? In the mean time, I'll merge this one by hand. |
Most linters are disabled by default when using golangci-lint, we need
to explicitely enable them if we want them to run.
This change enables the basic golint support.
For more info please check https://golangci-lint.run/usage/quick-start