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
embed, cmd/go: add a way to exclude a file from embedding #42325
Comments
Originally posted by @SamWhited in #42321 (comment):
I tentatively disagree. It seems to me that if you wanted to exclude certain files you shouldn't have selected those files in the first place using the glob. I suspect allowing excluding individual files will end up with projects having giant lists of temp files to be excluded, one person excludes the |
That's a good suggestion, but I'm not sure it will work if someone has a difference between their build server and their testing server. The build server (possibly a laptop) might have extra files that don't exist on the testing server (for sake of argument, cloud CI), so the tests won't detect that the extra files have snuck in. |
This also seems like a problem that the embed mechanism doesn't need to solve. If I have a difference between the source on my build and testing server I have a problem with my build and testing server, not with my Go code. EDIT: to put it another way that may make my thinking here clearer: imagine on my testing server I accidentally download different dependencies into my |
I would disagree. Due to reasons discussed in #41191 (comment) I could have |
As for syntax it might be more obvious to add an exclude switch to the |
I like that idea in theory but I don’t think it could be compatible with the existing glob format. Maybe I’m wrong though. |
/cc @rsc |
Closing as a duplicate of #42328. Let's have the discussion there. |
Problem: if you embed a directory, it may embed unwanted files from the directory.
Proposal: Comments with
//go:embed-exclude
apply a filter of files to exclude from the embed.Example:
Given a directory with
static/a.txt
andstatic/.dot
:will just embed
static/a.txt
.Refs. #42321.
The text was updated successfully, but these errors were encountered: