-
Notifications
You must be signed in to change notification settings - Fork 252
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
.github: Add a sanity check for Go packages #596
.github: Add a sanity check for Go packages #596
Conversation
Codecov Report
@@ Coverage Diff @@
## master #596 +/- ##
=======================================
Coverage 48.80% 48.80%
=======================================
Files 90 90
Lines 6276 6276
=======================================
Hits 3063 3063
Misses 2528 2528
Partials 685 685
Continue to review full report at Codecov.
|
a3d5fc8
to
4a3c419
Compare
b0a4bb2
to
25cee33
Compare
/retitle .github: Add a sanity check for Go packages |
/retest |
25cee33
to
d82fb48
Compare
/test all |
af56b01
to
4197047
Compare
4197047
to
1e490c7
Compare
- name: Install goimports | ||
run: go install golang.org/x/tools/cmd/goimports@latest | ||
- name: Run sanity checks | ||
run: make vendor && make lint && git diff --exit-code |
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 can also just split this out to run the linting check and remove that lint
make target:
goimports -w $(find . -name '*.go' -not -path "./vendor/"
And then have the git diff ...
check in another step. Open to suggestions on how to best organize this, or whether we're fine with throwing this under a single step.
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.
Just my personal preference, but I like to have make targets that encapsulate the github jobs so that things are eay to reproduce locally with as little hassle as possible, including getting and using the correct version of whatever tool the Makefile depends on.
Not something I would hold this up for at all, but in SDK we ended up with this script and then make targets would call it like this: https://github.com/operator-framework/operator-sdk/blob/4e16f401032ca61f1e57203840dbc303de365f42/Makefile#L126
It was nice because:
- If we ever needed to switch to a different CI runner (which happened three times between Travis/Openshift CI and then to GitHub actions), it was pretty simple.
- Anyone calling the make target is using the version specified, rather than whatever is on their path.
- No one has to worry about figuring out how to get the various tools in the first place.
Whenever we had a new tool dependency, it was pretty easy to tack it onto the end of that case block in the fetch script.
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.
Yeah, absolutely that makes a lot of sense. I'll dive into those links some more - I think I would prefer getting something merged sooner-than-later just because this PR also changes files after running goimports
locally, so it seems like some editors aren't fully set up to format on save. Going forward, and there's already a TODO in this PR about running go vet ...
as well, we should probably aim towards emulating some of that SDK workflow.
/lgtm |
/retest |
1 similar comment
/retest |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ecordell, timflannagan 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 |
Add a vendor check to the testing actions that runs
$(make) vendor
andverifies that the vendor directory is up-to-date and no
git diff
hasbeen produced.
Description of the change:
Motivation for the change:
Reviewer Checklist
/docs