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
cmd/gofmt: ignore vendor directory #22173
Comments
Have you tried |
vendor
directory on gofmt command
/cc @griesemer |
Yes, I tried to use (and also I'm using) Actually,
Therefore, I feel it is convenient if |
It is not a subset, it is a wrapper. The important difference between |
In addition to the discussion above. There is need for formating and simplification code at the same time ( excluding vendor ) . |
Yes, it’s right. My expression was wrong, but I understand the behavior of both.
That is a good point. |
If there is a resolution to this, it should be to let |
I agree this. |
@moznion could you please send your changes using regular flow, otherwise I'm afraid it wouldn't be reviewed |
@superstas Sure, I'll do that. |
Change https://golang.org/cl/70030 mentions this issue: |
I really hope that vendor directories will diminish in importance once proper package management arrives. Let's just not do anything special here for gofmt of vendor directories. |
- if we put it at project root and run gofmt ., vendor folder will get formatted as well - golang/go#22173
So users and CI tooling can keep our Go clean :). The find call avoids formatting .build/* (Bazel output) and vendor/* (controlled upstream), because gofmt has no special vendor/ handling built in [1]. [1]: golang/go#22173 (comment)
So users and CI tooling can keep our Go clean :). The find call avoids formatting .build/* (Bazel output) and vendor/* (controlled upstream), because gofmt has no special vendor/ handling built in [1]. Formatting our Go and then using 'git diff' to show the changes (and error if there were any) makes it easy for: * CI to see if there were issues (because of the exit code). * Users to see the required changes in the CI logs (because of the output diff). [1]: golang/go#22173 (comment)
So users and CI tooling can keep our Go clean :). The find call avoids formatting .build/* (Bazel output) and vendor/* (controlled upstream), because gofmt has no special vendor/ handling built in [1]. Formatting our Go and then using 'git diff' to show the changes (and error if there were any) makes it easy for: * CI to see if there were issues (because of the exit code). * Users to see the required changes in the CI logs (because of the output diff). [1]: golang/go#22173 (comment)
So users and CI tooling can keep our Go clean :). The find call avoids formatting .build/* (Bazel output) and vendor/* (controlled upstream), because gofmt has no special vendor/ handling built in [1]. Formatting our Go and then using 'git diff' to show the changes (and error if there were any) makes it easy for: * CI to see if there were issues (because of the exit code). * Users to see the required changes in the CI logs (because of the output diff). [1]: golang/go#22173 (comment)
Go's dependency management mechanism treats
vendor
directory specially to import external packages.Currently, the
gofmt
command formats files even if those are managed under thevendor
.I think
gofmt
command should ignore the files under thevendor
.How does it feel?
(I wrote PoC patch here: https://github.com/golang/go/compare/master...moznion:gofmt_ignore_vendor_dir?expand=1)
The text was updated successfully, but these errors were encountered: