-
Notifications
You must be signed in to change notification settings - Fork 38.6k
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 in some pkg/kubelet packages #75303
Fix golint failures in some pkg/kubelet packages #75303
Conversation
Hi @obitech. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
/assign @vishh |
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.
Overall, this looks good to me (modulo some small changes which I think should be easy)! I don't have approval rights, but thanks for tackling these lint errors :)
One request - can you please also update .hack/.golint_failures
to remove these packages (if they are now fully passing golint)?
@@ -14,7 +14,6 @@ See the License for the specific language governing permissions and | |||
limitations under the License. | |||
*/ | |||
|
|||
// Reads the pod configuration from the Kubernetes apiserver. |
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.
Curiosity question... how did this comment violate the golinter? Or did you just decide it wasn't necessary?
Either is fine, just curious :)
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.
Hmm, when I first ran it, golint gave me an error because every package should only have one package level comment (basically a comment above the package
statement). However, if I try to reproduce it (by putting comments back into the top of the files) now, I don't get any errors. If you want I can put them back in. However, I think we should rather come up with a true package-level comment instead of comments describing what the file does.
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 don't think we need this comment here, the methods in this file are commented.
the package itself should be documented though.
/ok-to-test |
@obitech thanks for your pr :) After making the changes I described, you may want to tag an additional approver. You can find a list of approvers here: https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/OWNERS |
Just a heads up, the |
Hey Matt, thanks for your reply on this! I will check out your suggestions. Regarding the |
/assign @derekwaynecarr |
25b1fc8
to
7df283f
Compare
/retest |
7df283f
to
c8c2368
Compare
/test pull-kubernetes-kubemark-e2e-gce-big |
All tests are passing, assigning additional approver for /assign @soltysh |
@derekwaynecarr golint was throwing the following error:
From what I can tell the import is not used anymore and I had troubles coming up with a reason/comment why it should remain, so I removed it. |
5646bc0
to
22bf71b
Compare
22bf71b
to
0e4b264
Compare
Does this PR need any more attention from me? Any chance to merge this before the code freeze? |
Unfortunately, I think this missed code freeze :( Hopefully it will be an early candidate for merge when the repo unfreezes. In the mean time, I think you need to do a quick rebase because of some conflicts with Thanks again for your work here :) |
55ad932
to
6c4bcb8
Compare
Ah no worries, I'll wait a bit longer then :) |
/retest |
/uncc |
6c4bcb8
to
50c7d1c
Compare
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.
have a question on why an import was removed.
pkg/kubelet/config/common.go
Outdated
// TODO: remove this import if | ||
// api.Registry.GroupOrDie(v1.GroupName).GroupVersion.String() is changed | ||
// to "v1"? | ||
"k8s.io/kubernetes/pkg/api/legacyscheme" | ||
_ "k8s.io/kubernetes/pkg/apis/core/install" |
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.
why was this removed?
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 removed it becaused golint
was complaining the blank import:
pkg/kubelet/config/common.go:37:2: a blank import should be only in a main or test package, or have a comment justifying it
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.
@derekwaynecarr should I put it back in? I'll have to put pkg/kubelet/config
back on .golint-failures
though.
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.
that package has an init function.
https://github.com/kubernetes/kubernetes/blob/master/pkg/apis/core/install/install.go#L29
I think you need to keep the import but add a comment so it passes.
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 put the import back in, unfortunately golint
doesn't seem to allow ignoring individual lines so I had to put pkg/kubelet/config
back into .golint-failures
. But we're still passing a lot more golint
so this should be fine I think
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 put the import back in, unfortunately golint doesn't seem to allow ignoring individual lines so I had to put pkg/kubelet/config back into .golint-failures.
er to clarify ...
I think you need to keep the import but add a comment so it passes.
@derekwaynecarr is not saying to put comment to suppress go lint like say, pylint. go lint is requiring that you have a comment justifying the import if you have an underscore import, IE we should comment about the dependency on init()
/test pull-kubernetes-e2e-gce-100-performance |
Fixed: - pkg/kubelet/pod - pkg/kubelet/metrics - pkg/kubelet/configmap - pkg/kubelet/config
50c7d1c
to
17d2ba0
Compare
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.
/approve
/lgtm
/assign @BenTheElder |
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.
/approve
for hack
I suspect you can get these other packages passing again and remove them as well by commenting on why we underscore import these other packages.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: BenTheElder, derekwaynecarr, obitech 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 |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Fixes golint failures for packages under
pkg/kubelet/
:ref: #68026
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: