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
CLI argument to ignore paths #250
Comments
How about not using the As far as argument size limits, we could support a newline-separated list of filenames fed via a plaintext file, which is the same workaround that |
One such fixture is auto-generated go code generated by https://github.com/shurcooL/vfsgen, these absolutely must bear the Still, from a performance standpoint, ignoring Taking file path input from a (temporary) file would also work for us, that would be welcome to have. |
I'm surprised to hear code generators like vfsgen are still being used, now that Typically, if a project uses
That is what I would personally do. It does add an automated step to your
Doing it seems like a good idea in any case. If this issue moves in a different direction, then I'll split that into its own issue.
I'd rather not invent something new in this space. We do already skip |
I'm facing another issue where an excldue arg would be handy. I have to include license files in my projects and IntelliJ / Goland has the concept of file templates which will be added to Go files. They put these file templates under I agree that they should not use the file extension, but the point is that developers have to integrate with several of these usecases where it's not really up to us to chnage this. An exclude parameter in that case would come in really handy, otherwise it will fail:
I'm sure there are more legitimate usecases which would benefit from an exclude parameter. |
I actually forgot to mention, @silverwind, that generated files are treated in a special way, per the README:
The magic string is Line 117 in 3d971cb
@weeco like you point out, your case is broken by design: it's likely that many other existing Go tools, like
The only other use case mentioned here is generated files, which is already handled per the above. If Go tools in general come up with a standard in golang/go#42965, I'll be happy to follow. I'm reluctant to make up my own standard in the meantime. |
Thinking about excluding |
I wonder why you want to force naming conventions like |
BTW for generated file detection, there is a common pattern to mark them as such via foo/*.go linguist-generated There are other variants of this name as well, like |
I guess we could also teach gofumpt to look for |
See kubernetes as one example that has https://github.com/kubernetes/kubernetes/blob/master/.gitattributes |
Having configurability via |
Interesting example with kubernetes. It does seem like they're not following the Go standard, which is concerning. There doesn't seem to be a good reason, so I'm willing to bet they just didn't notice. I hear you about |
I see I never answered: |
In some cases, it's desirable to not format certain files like test fixtures. Ignoring such files can be achieved by passing a explicit list of files to gofump, but then big projects risk into running into the maximum command line length which on Windows is only 8191 characters.
I suggest to support a
-exclude
argument where users could pass individual files to exclude to the CLI. It should support both file and directory arguments. Another benefit of such a argument is to speed up the invocation by ignoring big directories likenode_modules
which often contain upwards of 100k files.go run mvdan.cc/gofumpt@v0.4.0 -exclude test/fixture.go,fixtures,node_modules .
The text was updated successfully, but these errors were encountered: