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

enable stylecheck check in golangci #111101

Merged
merged 1 commit into from Jul 19, 2022
Merged

Conversation

Abirdcfly
Copy link
Member

@Abirdcfly Abirdcfly commented Jul 13, 2022

Signed-off-by: Abirdcfly fp544037857@gmail.com

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

I noticed that there are some related pr to fix the duplicate import issue, and we can fix it earlier by adding detection to golangci-lint.
#109639 should fix all old issue. Add detection to golangci to avoid later problems.

cmd/kubeadm/app/util/dryrun/dryrun.go:29:2: ST1019: package "k8s.io/kubernetes/cmd/kubeadm/app/constants" is being imported more than once (stylecheck)
        "k8s.io/kubernetes/cmd/kubeadm/app/constants"
        ^
cmd/kubeadm/app/util/dryrun/dryrun.go:30:2: ST1019(related information): other import of "k8s.io/kubernetes/cmd/kubeadm/app/constants" (stylecheck)
        kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
        ^

Which issue(s) this PR fixes:

Special notes for your reviewer:

source

Go allows importing the same package multiple times, as long as different import aliases are being used. That is, the following bit of code is valid:
import (
    "fmt"
    fumpt "fmt"
    format "fmt"
    _ "fmt"
)

However, this is very rarely done on purpose. Usually, it is a sign of code that got refactored, accidentally adding duplicate import statements. It is also a rarely known feature, which may contribute to confusion.

Do note that sometimes, this feature may be used intentionally (see for example golang/go@3409ce3) – if you want to allow this pattern in your code base, you’re advised to disable this check.

As far as I know, k8s does not use this feature.

Does this PR introduce a user-facing change?

None

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jul 13, 2022
@k8s-ci-robot
Copy link
Contributor

@Abirdcfly: This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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.

@k8s-ci-robot k8s-ci-robot added the needs-priority Indicates a PR lacks a `priority/foo` label and requires one. label Jul 13, 2022
Signed-off-by: Abirdcfly <fp544037857@gmail.com>
@Abirdcfly
Copy link
Member Author

/assign @thockin

@Abirdcfly Abirdcfly changed the title [wip] enable stylecheck check in golangci enable stylecheck check in golangci Jul 13, 2022
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 13, 2022
@Abirdcfly
Copy link
Member Author

/sig testing
I guess

@k8s-ci-robot k8s-ci-robot added sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jul 13, 2022
@thockin
Copy link
Member

thockin commented Jul 14, 2022

I like it. Obviously it needs #109639

/approve
/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Abirdcfly, thockin

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 14, 2022
@Abirdcfly
Copy link
Member Author

/hold
until #109639 merged first

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 14, 2022
@Abirdcfly
Copy link
Member Author

/test pull-kubernetes-verify

@liggitt
Copy link
Member

liggitt commented Jul 19, 2022

/retest
/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 19, 2022
@k8s-ci-robot k8s-ci-robot merged commit 6f9fd45 into kubernetes:master Jul 19, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.25 milestone Jul 19, 2022
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. 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. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants