-
Notifications
You must be signed in to change notification settings - Fork 37
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
feat: add golangci-lint check #74
base: main
Are you sure you want to change the base?
Conversation
4adbb0b
to
bab013f
Compare
Signed-off-by: Abirdcfly <[email protected]>
bab013f
to
9723202
Compare
Hi @Abirdcfly - Thank you for the addition of the code simplification tools. Unfortunately, golangci-lint package has been released under a GPL license, and is incompatible with the operator's Apache license requirement. The golang.org linters are OK to enable. Can we aim for extensions to the CI pipeline that focus on improvements to the golang linters, and make incremental updates to the areas of code that can be simplified? (I do prefer many of the suggestions made by the gosimple linter - the code changes look pretty good.) |
Thank you very much for pointing out the license problem, to be honest, I'm not very clear about it, the reason why golangci-lint is used is because this tool is widely used by kubernetes(Apache License 2.0) and other projects in the kubernetes ecosystem. Through some small research, I found that there are also many other Apache License 2.0 projects using golangci-lint tool directly, for example:
There are other projects that use golangci-lint-action (MIT License) Just like this pr does:
Some libraries we depend on also use golangci-lint:
Some projects in hyperledger-labs is Apache License 2.0, also use golangci-lint action:
I investigated this issue because I also have a project that is Apache License 2.0 but uses golangci-lint to check the source code, and from the results above, this seems to be possible and widespread. |
We may be OK to run a GPL code linter during the build pipeline, provided that the GPL libraries are not linked in to the binaries, runtime, libraries, or docker image generated by the build. |
This pr introduces golangci-lint to detect problems with go source code.
And turns on 4 linters: gofmt goimports govet gosimple
(The first 3 linters are maintained by golang.org, gosimple is a linter enabled by golangci-lint default)
See a list of supported linters and which linters are enabled/disabled in https://golangci-lint.run/usage/linters/.