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

presubmit: check import path ordering #3636

Merged
merged 1 commit into from
Jan 30, 2020
Merged

presubmit: check import path ordering #3636

merged 1 commit into from
Jan 30, 2020

Conversation

miekg
Copy link
Member

@miekg miekg commented Jan 29, 2020

Add a test for this as well as it's annoying to point out in every code
review.
Fix all the import paths that are flagged by this new test.

Fixes: #3634

Add a test for this as well as it's annoying to point out in every code
review.
Fix all the import paths that are flagged by this new test.

Fixes: #3634

Signed-off-by: Miek Gieben <miek@miek.nl>
@codecov-io
Copy link

Codecov Report

Merging #3636 into master will decrease coverage by 0.02%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3636      +/-   ##
==========================================
- Coverage    56.6%   56.58%   -0.03%     
==========================================
  Files         220      220              
  Lines       11039    11039              
==========================================
- Hits         6249     6246       -3     
- Misses       4311     4313       +2     
- Partials      479      480       +1
Impacted Files Coverage Δ
plugin/test/scrape.go 0% <ø> (ø) ⬆️
plugin/trace/trace.go 79.06% <ø> (ø) ⬆️
plugin/dnssec/dnskey.go 69.76% <ø> (ø) ⬆️
plugin/etcd/etcd.go 0% <ø> (ø) ⬆️
plugin/kubernetes/setup.go 64.24% <ø> (ø) ⬆️
test/server.go 82.75% <ø> (ø) ⬆️
plugin/kubernetes/metrics.go 78.57% <0%> (-21.43%) ⬇️

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 da7f65b...4a00232. Read the comment docs.

Copy link
Collaborator

@bradbeam bradbeam left a comment

Choose a reason for hiding this comment

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

Have we already looked at something like https://github.com/golangci/golangci-lint?
There's an option around checking for the code to be formatted, I can't remember off the top of my head if it check import path ordering.

@miekg
Copy link
Member Author

miekg commented Jan 29, 2020 via email

@miekg
Copy link
Member Author

miekg commented Jan 29, 2020

See https://twitter.com/peterbourgon/status/1222512198972514305 new goimport will do this differently, and just lump them together. I'll update to that version and check, then we can drop this and just check gofmted-ness of the code.

@miekg
Copy link
Member Author

miekg commented Jan 29, 2020

I can't replicate the new behaviour of goimports

@jameshartig
Copy link
Collaborator

jameshartig commented Jan 29, 2020

It seems like the -local option might be what we want here but the docs say it puts local imports after the third-party imports. What do you think about that?

I can confirm with some light testing that it puts them after but according to golang/go#31646 it puts them before?

Either way, it doesn't seem to reorganize existing blocks.

@miekg
Copy link
Member Author

miekg commented Jan 29, 2020 via email

@miekg
Copy link
Member Author

miekg commented Jan 30, 2020

Once goimports is changes/fixed we should probably revert this and stop caring about having three blocks.

@miekg miekg merged commit 995179a into master Jan 30, 2020
@miekg miekg deleted the import-ordering branch January 30, 2020 09:19
nyodas pushed a commit to DataDog/coredns that referenced this pull request Oct 26, 2020
Add a test for this as well as it's annoying to point out in every code
review.
Fix all the import paths that are flagged by this new test.

Fixes: coredns#3634

Signed-off-by: Miek Gieben <miek@miek.nl>
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.

presubmit to check import ordering and layout
4 participants