-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Migrate to golangci-lint #3023
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
Migrate to golangci-lint #3023
Conversation
Please sign your commits following these rules: $ git clone -b "feature/golangci-lint" git@github.com:sayboras/distribution.git somewhere
$ cd somewhere
$ git commit --amend -s --no-edit
$ git push -f Amending updates the existing PR. You DO NOT need to open a new one. |
14c3972
to
ff12894
Compare
@tariq1890 please help to take a look on this PR. Thanks |
d4615c2
to
d3bbfda
Compare
dde82ee
to
e6e8064
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.
I added some suggestions to pass CI.
Makefile
Outdated
@@ -50,7 +50,7 @@ version/version.go: | |||
|
|||
check: ## run all linters (TODO: enable "unused", "varcheck", "ineffassign", "unconvert", "staticheck", "goimports", "structcheck") | |||
@echo "$(WHALE) $@" | |||
gometalinter --config .gometalinter.json ./... | |||
@golangci-lint run |
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.
@golangci-lint run | |
@GO111MODULE=off golangci-lint run |
@@ -12,7 +12,6 @@ import ( | |||
"syscall" | |||
"time" | |||
|
|||
"github.com/Shopify/logrus-bugsnag" |
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.
"github.com/Shopify/logrus-bugsnag" | |
logrus_bugsnag "github.com/Shopify/logrus-bugsnag" |
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 a lot 💯
d91fb6e
to
db09756
Compare
15881a9
to
2d19491
Compare
Codecov Report
@@ Coverage Diff @@
## master #3023 +/- ##
=======================================
Coverage 60.74% 60.74%
=======================================
Files 102 102
Lines 8077 8077
=======================================
Hits 4906 4906
Misses 2519 2519
Partials 652 652
Continue to review full report at Codecov.
|
0426d8d
to
31f7ec9
Compare
@dmcgowan @manishtomar @tariq1890 any input for this PR ? Thanks |
@sayboras I'll take a look |
.golangci.yml
Outdated
@@ -0,0 +1,150 @@ | |||
# options for analysis running |
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.
Where did this version of the lint config come from?
In general, I would like to see this converge with containerd's configuration, see https://github.com/containerd/containerd/blob/master/.golangci.yml
If there are changes here I would like to see them applied in both places
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.
Oh this one is coming from example
config from golangci-lint.
However, it's making sense to keep the same as other repo (e.g. containerd). Let me make an update.
go.mod
Outdated
google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a // indirect | ||
gopkg.in/check.v1 v1.0.0-20141024133853-64131543e789 | ||
gopkg.in/yaml.v2 v2.2.2 | ||
google.golang.org/grpc v1.21.0 // indirect |
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.
where is this grpc version change from?
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 unintentional changes, I have reverted go.mod
d995aa4
to
521e48d
Compare
@dmcgowan the changes are cleaner now. Please help to take another look. |
@dmcgowan please let me know if you have any comments, happy to address. |
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! overall these changes look good, but some cleaning up might be good to not break git bisect
; currently, the first commit switches to golangci-lint, and follow-up commits fix linking issues. That means that if someone would try a git bisect, the commit that switches to golangci-lint would "fail".
Ideally (but I'm not a maintainer on this repo);
- rebase and re-order commits to first have all the fixes (those fixes should already work with the old linter)
- move the "switch to golangci-lint" to be the last commit
I haven't checked all commits, but some of the "linting fix" commits could possibly be squashed (e.g. master already switched to Go 1.12.x)
Just curious if it's ok for me to squash all commits into one :) |
Signed-off-by: Tam Mach <sayboras@yahoo.com>
6623bd1
to
6680964
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.
LGTM
To fix #2944
Currently, I keep the same set of linters we have from gometalinter.
Minor changes for below linting error