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

enhance importsort with directory support & exclude flag #47

Conversation

danielfoehrKn
Copy link

In multiple projects I am working on (e.g gardener - see example file), we are using the same import grouping this tool supports

  • stdlib,
  • VCS repo-local
  • non-local

Added support for directories and the possibility to define a regex pattern for excluded filenames. This is useful in our case to exclude auto-generated files.

This tool is somewhat one of the only simple enough tools I found to achieve this import grouping, so kudos for that.

@codecov-io
Copy link

codecov-io commented Dec 15, 2019

Codecov Report

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

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #47   +/-   ##
=======================================
  Coverage   76.46%   76.46%           
=======================================
  Files          13       13           
  Lines        1198     1198           
=======================================
  Hits          916      916           
  Misses        246      246           
  Partials       36       36

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 5d8d36c...51bbd6a. Read the comment docs.

@danielfoehrKn
Copy link
Author

Ping?

@aaronbee
Copy link
Member

Hello, thanks for the contribution!

I'd rather not add these features to importsort because you can do this filtering with other tools, like find.

For example, something like this that finds all go files that are not in the vendor directory or has a name that suggests it was generated:

files=$(find . -name '*.go' ! -path './vendor/*' ! -name '*.pb.go' ! -name '*.gen.go' -print0)
echo "$files" | xargs goimports -l
echo "$files" | xargs importsort -l

Please feel free to fork this utility. It is not being actively maintained anymore.

@aaronbee aaronbee closed this Dec 17, 2019
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

3 participants