-
-
Notifications
You must be signed in to change notification settings - Fork 652
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
Go: support resource embedding #13193
Comments
resource
and file
targetsresource
and file
targets)
This can be split into three steps:
I will take the first two steps, @tdyas has offered to do the third step. |
This comment has been minimized.
This comment has been minimized.
resource
and file
targets)
I investigated further, and as it turns out, we don't actually need to do the transformation from raw resource file to Go file; the compiler will do that for us. We just have to provide an "embedcfg" to the compiler to map the patterns to actual file paths. #13509 adds an |
Amazing! I can do part 2 and also complete part 1 to hook up Thanks! |
That will help re third-party; I haven't thought through exactly how file embedding should work in third-party packages. I assume the file patterns will just be evaluated relative to the package directory in that case. You will need to implement your own globbing logic to construct the Bazel rules_go implements its matching logic using its own virtual directory tree. See https://github.com/bazelbuild/rules_go/blob/bd7fbccc635af297db7b36f6c81d0e7db7921cca/go/tools/builders/embedcfg.go#L291 The |
https://pkg.go.dev/embed has a description of the glob format:
|
I'm currently implementing this. The best approach was to use glob matching code in Go to ensure the same semantics as the |
We need to support
resource
targets being included via Go's embed directive. https://pkg.go.dev/embedUnclear how
files
should be handled.The text was updated successfully, but these errors were encountered: