-
-
Notifications
You must be signed in to change notification settings - Fork 316
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
Set up golangci-lint linter based on gometalinter #670
base: master
Are you sure you want to change the base?
Set up golangci-lint linter based on gometalinter #670
Conversation
I see:
Did you u+x the file? Where do you see the list of lint errors we expect? |
42c144f
to
19116af
Compare
@purpleidea Whoops, must've forgot to change that. Fixed it and squashed. |
Great! Please rebase to master and force-push and let's see what happens. (I pushed some fixes.) |
19116af
to
9d05a93
Compare
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.
Patch looks good, just needs a few small changes.
Also check your $EDITOR, it's letting you save files without EOF newlines.
misc/make-deps.sh
Outdated
@@ -157,6 +157,9 @@ go get golang.org/x/lint/golint # for `golint`-ing | |||
go get golang.org/x/tools/cmd/goimports # for fmt | |||
go get github.com/kevinburke/go-bindata/go-bindata # for compiling in non golang files | |||
go get github.com/dvyukov/go-fuzz/go-fuzz # for fuzzing the mcl lang bits | |||
# heavily recommended to use curl to install instead of go get under https://golangci-lint.run/usage/install/ | |||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.41.1 |
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.
why is this version hardcoded? can we use the latest version? is there a safer way to do this so we don't pipe to shell? if not, please change this so it only runs in ci.
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.
It is recommended to use a specific version as per the installation instructions (https://golangci-lint.run/usage/install/), to avoid introducing new linter errors from new minor or major releases. However, would it still be preferred to use the latest 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.
I have changed this to something else. Any thoughts of it now?
# using .golangci.yml config file settings in ROOT | ||
gcl='golangci-lint run' | ||
|
||
# commented out from gometalinter linter test |
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.
are these five lines of comments valid?
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.
Added these lines in case somebody were to move over any changes from gometalinter to golangci-lint. There were some linters which were entirely commented out, whereas some were still left as TODO, since they still require some fixes. More for clarity purposes, but they can be removed.
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.
Are they still valid?
0b0a333
to
62407e2
Compare
4d5cf02
to
021b5bb
Compare
021b5bb
to
5ffc591
Compare
skip-files: | ||
- lang/lexer.nn.go | ||
- lang/y.go | ||
- bindata/bindata.go |
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.
This is/will be removed in #671 so if that's merged first, this will need to be rebased and updated
@@ -157,10 +157,35 @@ go get golang.org/x/lint/golint # for `golint`-ing | |||
go get golang.org/x/tools/cmd/goimports # for fmt | |||
go get github.com/kevinburke/go-bindata/go-bindata # for compiling in non golang files | |||
go get github.com/dvyukov/go-fuzz/go-fuzz # for fuzzing the mcl lang bits | |||
|
|||
if in_ci; then | |||
go get -u gopkg.in/alecthomas/gometalinter.v1 && \ | |||
mv "$(dirname $(command -v gometalinter.v1))/gometalinter.v1" "$(dirname $(command -v gometalinter.v1))/gometalinter" && \ |
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.
Can you remove all of the gometalinter references from here and other places in the codebase?
# sh -s -- -b $(go env GOPATH)/bin/golangci-lint v1.42.0 | ||
|
||
# curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.42.0 | ||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh > $(go env GOPATH)/bin/golangci-lint-install |
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 don't know what @purpleidea thinks about this, but it seems wise to run this check in Github Actions, at least when running in Github. Perhaps we can skip installation and running in GH and only do it in other CI systems? Then to provide the same functionality, drop in the relevant configuration into https://github.com/purpleidea/mgmt/blob/master/.github/workflows/test.yaml
https://golangci-lint.run/usage/install/#github-actions
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.
To clarify (as explained on the linked page), this provides useful comments in PRs in context of where the issues are, instead of being hidden away in the actions tab
@ginywiny Want to rebase to newest master and fixup? |
@purpleidea I will rebase and make a fix. |
9e8c92c
to
a009c52
Compare
2319f4f
to
04f5ba6
Compare
fe2313c
to
271a94e
Compare
b8072b2
to
380004b
Compare
Creating a new PR because the previous one had a weird amount of strange commit history which went over my head to squash despite the many attempts taken.
Test HIGHLY based on test-gometalinter, as it is used to lint the same files, except where golangci-lint is used instead of gometalinter.
Notes:
What was done: