Skip to content

Conversation

sayboras
Copy link
Contributor

@sayboras sayboras commented Oct 9, 2019

To fix #2944

Currently, I keep the same set of linters we have from gometalinter.

Minor changes for below linting error

cmd/registry-api-descriptor-template/main.go:24                 goimports  File is not `goimports`-ed
registry/storage/driver/middleware/cloudfront/middleware.go:19  goimports  File is not `goimports`-ed
blobs.go:13                                                     goimports  File is not `goimports`-ed

@GordonTheTurtle
Copy link

Please sign your commits following these rules:
https://github.com/moby/moby/blob/master/CONTRIBUTING.md#sign-your-work
The easiest way to do this is to amend the last commit:

$ 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.

@sayboras
Copy link
Contributor Author

sayboras commented Oct 9, 2019

@tariq1890 please help to take a look on this PR. Thanks

@sayboras sayboras force-pushed the feature/golangci-lint branch from d4615c2 to d3bbfda Compare October 9, 2019 11:50
@sayboras sayboras force-pushed the feature/golangci-lint branch 3 times, most recently from dde82ee to e6e8064 Compare October 9, 2019 12:02
Copy link

@cappyzawa cappyzawa left a 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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@golangci-lint run
@GO111MODULE=off golangci-lint run

@@ -12,7 +12,6 @@ import (
"syscall"
"time"

"github.com/Shopify/logrus-bugsnag"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"github.com/Shopify/logrus-bugsnag"
logrus_bugsnag "github.com/Shopify/logrus-bugsnag"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks a lot 💯

@sayboras sayboras force-pushed the feature/golangci-lint branch 2 times, most recently from d91fb6e to db09756 Compare November 13, 2019 12:29
@sayboras sayboras force-pushed the feature/golangci-lint branch from 15881a9 to 2d19491 Compare November 13, 2019 12:42
@codecov
Copy link

codecov bot commented Nov 13, 2019

Codecov Report

Merging #3023 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3023   +/-   ##
=======================================
  Coverage   60.74%   60.74%           
=======================================
  Files         102      102           
  Lines        8077     8077           
=======================================
  Hits         4906     4906           
  Misses       2519     2519           
  Partials      652      652
Flag Coverage Δ
#linux 60.74% <ø> (ø) ⬆️
Impacted Files Coverage Δ
registry/handlers/manifests.go 52.82% <ø> (ø) ⬆️
registry/client/repository.go 59.76% <ø> (ø) ⬆️
registry/handlers/tags.go 73.07% <ø> (ø) ⬆️
registry/handlers/blob.go 72.54% <ø> (ø) ⬆️
registry/storage/manifeststore.go 75.36% <ø> (ø) ⬆️
registry/handlers/app.go 48.16% <ø> (ø) ⬆️
registry/storage/ocimanifesthandler.go 68.85% <ø> (ø) ⬆️
manifest/ocischema/builder.go 66.66% <ø> (ø) ⬆️
registry/storage/schema2manifesthandler.go 65.57% <ø> (ø) ⬆️
registry/handlers/context.go 80.76% <ø> (ø) ⬆️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a837179...6680964. Read the comment docs.

@sayboras sayboras force-pushed the feature/golangci-lint branch from 0426d8d to 31f7ec9 Compare December 9, 2019 11:33
@sayboras
Copy link
Contributor Author

sayboras commented Dec 9, 2019

@dmcgowan @manishtomar @tariq1890 any input for this PR ? Thanks

@dmcgowan
Copy link
Collaborator

@sayboras I'll take a look

.golangci.yml Outdated
@@ -0,0 +1,150 @@
# options for analysis running
Copy link
Collaborator

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

Copy link
Contributor Author

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
Copy link
Collaborator

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?

Copy link
Contributor Author

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

@sayboras sayboras force-pushed the feature/golangci-lint branch 4 times, most recently from d995aa4 to 521e48d Compare December 16, 2019 13:14
@sayboras sayboras requested a review from dmcgowan December 16, 2019 13:16
@sayboras
Copy link
Contributor Author

@dmcgowan the changes are cleaner now. Please help to take another look.

@sayboras
Copy link
Contributor Author

sayboras commented Jan 6, 2020

@dmcgowan please let me know if you have any comments, happy to address.

Copy link
Member

@thaJeztah thaJeztah left a 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)

@sayboras
Copy link
Contributor Author

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".

Just curious if it's ok for me to squash all commits into one :)

Signed-off-by: Tam Mach <sayboras@yahoo.com>
Copy link
Collaborator

@dmcgowan dmcgowan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dmcgowan dmcgowan merged commit 244d524 into distribution:master Feb 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace linter to golang-cli
5 participants