Skip to content
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 undocumented golint errors #69269

Merged

Conversation

miguelbernadi
Copy link
Contributor

What this PR does / why we need it:
Fixes some golint errors due to missing comment descriptions. These were reported by running hack/verify-golint.sh directly, as they were not present in hack/.golint_failures.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Related to #68026

Special notes for your reviewer:

Release note:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Sep 30, 2018
@k8s-ci-robot k8s-ci-robot added needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Sep 30, 2018
@krmayankk
Copy link

/ok-to-test

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Sep 30, 2018
@miguelbernadi
Copy link
Contributor Author

It seems this PR interferes with the code generation. Any idea why? Is it possible to fix or should this just be discarded, as the golint violation is about comments? @dims

@krmayankk
Copy link

forgot about this, if this is generated things, then we will have to change this somewhere else . @kubernetes/api-reviewers might have some hints

@jennybuckley
Copy link

/assign @logicalhan

@k8s-ci-robot
Copy link
Contributor

@jennybuckley: GitHub didn't allow me to assign the following users: logicalhan.

Note that only kubernetes members and repo collaborators can be assigned.
For more information please see the contributor guide

In response to this:

/assign @logicalhan

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.

@logicalhan
Copy link
Member

I may be mistaken, but I believe that these files are actually code-generated, which means any lint errors you may be encountering will be reintroduced if these files are regenerated.

It is probably desirable to fix string which is used to generate this code (i.e. kubernetes/staging/src/k8s.io/code-generator/cmd/informer-gen/generators/factoryinterface.go) and then regenerate the files which have this lint error (I think there are more than just these two).

@logicalhan
Copy link
Member

It seems this PR interferes with the code generation. Any idea why? Is it possible to fix or should this just be discarded, as the golint violation is about comments? Davanum Srinivas

Oh, I just saw your comment. Yes, I believe that these files are code-generated, so it is probably prudent to resolve this at the source and re-generate the files in order to fix the lint error.

@logicalhan
Copy link
Member

I've looked into this and it seems that these files should be automatically excluded from lint since they are flagged as being code-generated. Would mind running golint against these files directly (without your changes) and letting me know what your output is?

@lavalamp
Copy link
Member

lavalamp commented Oct 1, 2018

Please fix at the source: https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/code-generator/cmd/informer-gen/generators/factoryinterface.go#L79

@miguelbernadi
Copy link
Contributor Author

I've looked into this and it seems that these files should be automatically excluded from lint since they are flagged as being code-generated. Would mind running golint against these files directly (without your changes) and letting me know what your output is?

$ golint ./pkg/client/informers/informers_generated/internalversion/internalinterfaces/factory_interfaces.go
./pkg/client/informers/informers_generated/internalversion/internalinterfaces/factory_interfaces.go:30:6: exported type NewInformerFunc should have comment or be unexported
./pkg/client/informers/informers_generated/internalversion/internalinterfaces/factory_interfaces.go:38:6: exported type TweakListOptionsFunc should have comment or be unexported
$ golint ./staging/src/k8s.io/sample-controller/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go
./staging/src/k8s.io/sample-controller/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go:30:6: exported type NewInformerFunc should have comment or be unexported
./staging/src/k8s.io/sample-controller/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go:38:6: exported type TweakListOptionsFunc should have comment or be unexported

I found them initially by running hack/verify-golint.sh before picking a violation to fix, expecting the results of execution would be empty, and found there were several violations.

@miguelbernadi
Copy link
Contributor Author

Please fix at the source: https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/code-generator/cmd/informer-gen/generators/factoryinterface.go#L79

I'll be doing this now. I hope it can fit in this PR in a clear history way, otherwise I'll close this and open a new one for that.

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Oct 3, 2018
@miguelbernadi
Copy link
Contributor Author

/kind cleanup

@k8s-ci-robot k8s-ci-robot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. and removed needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Oct 3, 2018
@@ -76,6 +76,7 @@ func (g *factoryInterfaceGenerator) GenerateType(c *generator.Context, t *types.
}

var externalSharedInformerFactoryInterface = `
// NewInformerFunc is a function returning a SharedIndexInformer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: probably not worth changing, but next time think about customizing the comment for the type. (and ending with a period ;) )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

codegen has to be updated for tests to pass, so I'll solve the nit as well. Should I rebase or add them as new commits?

@lavalamp
Copy link
Member

lavalamp commented Oct 8, 2018

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Oct 8, 2018
@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel comment for consistent failures.

2 similar comments
@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel comment for consistent failures.

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel comment for consistent failures.

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 9, 2018
@miguelbernadi
Copy link
Contributor Author

Addressed the nits and rebased on master (was failing verification due to new code-generated files). Added them as new commits, but open to squash them in 2 or 1 commit, as needed.

@miguelbernadi
Copy link
Contributor Author

@lavalamp ☝️

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 16, 2018
@mikedanese mikedanese removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 16, 2018
@mikedanese
Copy link
Member

mikedanese commented Oct 16, 2018

Edit: I see we are already fixing this in the code gen. I'm happy with this as is if others are.

@miguelbernadi
Copy link
Contributor Author

@mikedanese @lavalamp Nits addressed and commits squashed.

@mikedanese
Copy link
Member

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 16, 2018
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lavalamp, miguelbernadi, mikedanese

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@@ -35,4 +36,5 @@ type SharedInformerFactory interface {
InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer
}

// TweakListOptionsFunc is a function that applies a transform on v1.ListOptions.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gah I wrote my comment late at night. "is a function that applies a tranformation to a"? "is a function that transforms a"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

language corrected.

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 16, 2018
@mikedanese
Copy link
Member

Thanks!

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 16, 2018
@mikedanese
Copy link
Member

/retest

@k8s-ci-robot k8s-ci-robot merged commit 3143871 into kubernetes:master Oct 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/code-generation cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants