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 golint failures #68026
Comments
/sig architecture |
@dims Hey, I would like to resolve this issue. Could you assign it to me ? |
@fengzixu there are a lot of packages so there will be many people working on this. Also we cannot assign issue to folks who are not in the github org for kubernetes. please feel free to pick up a few packages like i mentioned and file a PR. Make sure you link back to this issue, so folks can see which packages you filed PR for. |
OK. I see. I will firstly pick up the package called |
Hi dims. @dims Should i submit my PR before i remove one or two packages (related packages) from the list in - https://github.com/kubernetes/kubernetes/blame/master/hack/.golint_failures ? Or I first remove the package from list, then I fix the issue and submit a PR? |
@fengzixu in your PR, you will have both the fixes to packages and some lines removed from /.golint_failures |
When I run
I found that there is a go file in github.com/kubernetes/kubernetes/cluster/addons/fluentd-elasticsearch/es-image/. But there is still a error. @dims |
|
1. pkg/client 2. staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/testing Related to: kubernetes#68026
Is it necessary to obey all rules in golint? Rules in golint are set in stone. Maybe using gometalinter to ignore some specific errors is better? @dims |
@mathspanda which errors would you like to ignore? if you can open a new issue with the list of errors to ignore (and proposing gometalinter), we can get some opinions there from others in the community. |
Let me take the kubectl cmd part...
|
Can someone please review and let me know if I am doing it right? #68176 |
I ll work on all the packages related to |
we get 800-ish pkgs left to fix. my concern is that if we fix them package by package, then such pulls will be flooding the repo. can't we possibly make it in larger pulls? the larger the better? |
@yue9944882 +1 to slightly larger pulls with related packages. if allow too large then the reviewers will not be able to do a thorough review. we should spread the load among multiple reviewers. (if we allow a really large pull, we will end up with top level reviewers who will face the burden and the PR(s) will just stagnate) |
oh good point. we could put one pkg's change into one commit, and merge all changes under one |
@yue9944882 sounds great! please feel free to help make it happen :) (by suggesting groups of packages that kinda go together) |
After a couple years of seeing changes spawned from this issue, I don't think this is a good use of contributors' or reviewers' time. golint is very opinionated about:
the govet and staticcheck verify jobs are much more useful since they catch correctness issues, but I would recommend closing this issue and dropping the golint checks from CI golint doc itself discourages from using its output in an automated enforced way: from https://github.com/golang/lint#purpose:
|
i guess one can say gofmt is opinionated too, but something good about Golang is that it comes with an opinion and a set of standard tools. for API documentation at least we found inconsistencies on how most exported API items are documented: golint can help with that, but if there are no "pragmas" to avoid breaking changes and given we have codegen generating non-compliant names enabling golint on API packages is sort of blocked in Kubernetes. for non-API, non-library, non-public code, i think being inconsistent is mostly OK.
no preference on my side. shrug |
true, but code formatting has the benefits of mostly eliminating meaningless diffs in PRs due to code movement/whitespace/etc
if there are specific packages (like API packages) we lack documentation on, adding checks specifically for that could make sense
exactly, I don't think golint is the right tool for making sure we have API docs |
golint itself doesn't have these and the go project is against this sort of comment AIUI, however golangci-lint does have them. I think there are plenty of other static analysis lints we should use instead, beyond just staticcheck and vet there is e.g. |
btw, if we remove golint can we see e.g. all-caps constants or functions with underscores dodging review? perhaps we should add golangci-lint soon after: |
/remove-help |
Overall agree on the bandwidth. Also note that it was a good first issue with very low bar to get them in the repo. May be we need to find a similar low bar, but high value good first issue. UT's come to mind, are there other things we curate for new contributors ? |
Do we have an alternative way of enforcing that new exported code (not necessarily API fields) has at least some minimum documentation? As a reviewer, I ask contributors to add meaningful comments. But reality is that I sometimes stumble into old code that doesn't have documentation because we didn't have golint at some point. I agree that fix-golint PRs just add burden to reviewers. But, before removing the lint check, can we wait and see if it's enough to discourage people from sending more PRs like this? |
+1 for adding burden to reviewers. |
@dims: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Anyone itching to understand the code and try fixing things in Kubernetes, please help fixing the lint failures
Step 1: Remove one or two packages (related packages) from the list in - https://github.com/kubernetes/kubernetes/blame/master/hack/.golint_failures (note: do not change generated files, the name of defaulting functions, or the name of conversion functions... packages failing linting due to issues in those files will need to be left alone)
Step 2: Run
hack/verify-golint.sh
and look at the logged errorsStep 3: Fix the code to ensure that
hack/verify-golint.sh
runs cleanly.Step 4: Run
hack/update-bazel.sh
andhack/update-gofmt.sh
to make sure we fix any problems with gofmt or bazel.Step 5: File a PR with the change
Step 6: Go to step #1 :)
Please use the tracking spreadsheet here For everyone who is going to contribute,
The text was updated successfully, but these errors were encountered: