-
Notifications
You must be signed in to change notification settings - Fork 690
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
add golangci lint GH action #2976
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2976 +/- ##
==========================================
+ Coverage 73.35% 73.38% +0.03%
==========================================
Files 95 95
Lines 6046 6046
==========================================
+ Hits 4435 4437 +2
+ Misses 1510 1509 -1
+ Partials 101 100 -1
|
use https://github.com/marketplace/actions/run-golangci-lint to lint code for new changes on PRs. Fixes #2972 Signed-off-by: Shayegan Hooshyari <[email protected]>
@Glyphack Could you add a lint error to this PR to see how the GH action displays it? |
Updates: #2976 Signed-off-by: Shayegan Hooshyari <[email protected]>
Updates: #2976 Signed-off-by: Shayegan Hooshyari <[email protected]>
@jpeach I added a unused function here is how it looks when action fails: |
@stevesloka I think this is a worthwhile improvement, WDYT? |
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.
Also will need to remove the steps which run this in the PR GH Action currently: https://github.com/projectcontour/contour/blob/main/.github/workflows/prbuild.yaml#L48-L58
.github/workflows/golangci-lint.yaml
Outdated
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v2 | ||
with: | ||
version: v1.29 |
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.
Any way we can keep the versions in sync with the Makefile
? (https://github.com/projectcontour/contour/blob/main/hack/golangci-lint#L15)
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 did not quite understand what you mean. Do you mean is there any way to sync these two versions or syncing it now from v1.29 to v.1.31.0?
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't think of a great way to have only a single place with the version. We might just have to live with it in multiple places like we do with the Go version :(
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.
There's a version in the hacks/golanglint-ci script as well as now in this GH Action PR. So we need to be diligent in keeping the two in in sync. This is the benefit of just leaving the Makefile doing the work and not having a separate action.
Updates: #2976 Signed-off-by: glyphack <[email protected]>
Updates: #2976 Signed-off-by: glyphack <[email protected]>
Updates: #2976 Signed-off-by: glyphack <[email protected]>
Updates: #2976 Signed-off-by: glyphack <[email protected]>
Can someone catch me up on projectcontour/.github#3 and this PR? Reading the backscroll, the idea of the |
Me and @jpeach thought that placing workflows under |
Yeh, I thought that |
@jpeach We can still move it into |
IIUC, that copies the workflow to each repo, and doesn't update when the template does. I'd be happy if I was wrong about that 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.
Thanks for the PR @Glyphack!
I'm personally fine with or without this PR, I don't really have a preference either way for if the linting runs as an action or not. I do find the integrated comments from the codecov action annoying and wish we could toggle them off, but this one probably won't be as spammy.
See one specific comment.
I also find the codecov annotations annoying when I'm reviewing. There's a toggle to turn them off in the top right of the source diff view. |
|
Updates: #2976 Signed-off-by: glyphack <[email protected]>
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.
Looks reasonable to me!
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.
LGTM
use golangci-lint action to lint new code changes on PRs.
Fixes #2972
Signed-off-by: Shayegan Hooshyari [email protected]