Skip to content
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

Enable some more golangci-lint checks, fix findings #1164

Merged
merged 3 commits into from
Nov 4, 2021

Conversation

imjasonh
Copy link
Collaborator

@imjasonh imjasonh commented Nov 4, 2021

There's still quite a bit of errchecks to chase down, but this is an
improvement at least.

god what a mind-numbing chore.

@codecov-commenter
Copy link

codecov-commenter commented Nov 4, 2021

Codecov Report

Merging #1164 (c4b24b7) into main (dd49079) will not change coverage.
The diff coverage is 59.32%.

❗ Current head c4b24b7 differs from pull request most recent head f889c58. Consider uploading reports for the commit f889c58 to get more accurate results
Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1164   +/-   ##
=======================================
  Coverage   75.22%   75.22%           
=======================================
  Files         108      108           
  Lines        7850     7850           
=======================================
  Hits         5905     5905           
  Misses       1379     1379           
  Partials      566      566           
Impacted Files Coverage Δ
pkg/legacy/tarball/write.go 67.18% <0.00%> (ø)
pkg/name/ref.go 100.00% <ø> (ø)
pkg/v1/cache/ro.go 100.00% <ø> (ø)
pkg/v1/google/list.go 70.81% <0.00%> (ø)
pkg/v1/layout/write.go 47.92% <ø> (ø)
pkg/v1/mutate/rebase.go 46.73% <0.00%> (ø)
pkg/v1/partial/index.go 61.36% <0.00%> (ø)
pkg/v1/remote/check.go 70.00% <0.00%> (ø)
pkg/v1/remote/transport/ping.go 91.46% <ø> (-0.11%) ⬇️
pkg/v1/mutate/mutate.go 71.94% <33.33%> (ø)
... and 24 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 dd49079...f889c58. Read the comment docs.

pkg/gcrane/copy.go Outdated Show resolved Hide resolved
pkg/name/errors.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@mattmoor mattmoor left a comment

Choose a reason for hiding this comment

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

I stopped commenting on them, but there were a bunch of // nolint errorlint that could be errors.As, and a license presubmit check, but otherwise this LGTM

@imjasonh imjasonh force-pushed the golangci-lint branch 3 times, most recently from 070d27b to 588c42a Compare November 4, 2021 14:55
There's still quite a bit of errchecks to chase down, but this is an
improvement at least.
_, ok := err.(*ErrBadName)
return ok
var berr *ErrBadName
return errors.As(err, &berr)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe this can just be errors.Is

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I tried a bunch of different ways and couldn't get it to work.

It turns out this method is never used outside of tests in pkg/name, so I just removed it and inlined it (with errors.As for now) into the two places in tests where it was used. In theory someone is using it today, since it was exported. If we want I can put it back and deprecate it.

I also removed NewErrBadName which isn't used outside of pkg/name, and should not be needed outside of pkg/name.

@mattmoor mattmoor merged commit a0c4bd2 into google:main Nov 4, 2021
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.

None yet

4 participants