kubernetes-sigs / cluster-addons

Addon operators for Kubernetes clusters.
Apache License 2.0
155 stars 47 forks source link

Add github workflows for gomod and goimports #83

Closed rajansandeep closed 4 years ago

rajansandeep commented 4 years ago

Adds workflow and also cleans up the test failures

stealthybox commented 4 years ago

We should consider ignoring vendor dirs in the context of go fmt. @justinsb mentions some of the benefits of keeping the vendor/ in the installer pkg and it would be a conscious decision to remove it that is out of scope for this patch.

justinsb commented 4 years ago

This LGTM, but we need to exclude vendor. It might be easiest as @njhale suggests to put the verification steps into a script / makefile target that the github CI then calls; that makes for faster iteration and a better dev experience.

justinsb commented 4 years ago

Searching around the web, the easiest way to ignore the vendor directory is likely to do this:

goimports -d $(find . -type f -name '*.go' -not -path "*/vendor/*")

(the go list alternative approach does not work with nested go modules, AFAICT)

WDYT @rajansandeep ?

rajansandeep commented 4 years ago

Searching around the web, the easiest way to ignore the vendor directory is likely to do this:

goimports -d $(find . -type f -name '*.go' -not -path "*/vendor/*")

(the go list alternative approach does not work with nested go modules, AFAICT)

WDYT @rajansandeep ?

@justinsb Yes, Thank you! I was on the same track except that the command you suggested didn't work for me somehow... maybe I had a typo... Anyways, now the vendor dir is excluded from the goimport checks.

justinsb commented 4 years ago

Thanks @rajansandeep - looks great!

/approve /lgtm

k8s-ci-robot commented 4 years ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: justinsb, rajansandeep

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: - ~~[OWNERS](https://github.com/kubernetes-sigs/cluster-addons/blob/master/OWNERS)~~ [justinsb] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment