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

proposal: cmd/go/internal/load: Make ResolveEmbed external #65610

Open
jordan-da opened this issue Feb 8, 2024 · 2 comments
Open

proposal: cmd/go/internal/load: Make ResolveEmbed external #65610

jordan-da opened this issue Feb 8, 2024 · 2 comments
Milestone

Comments

@jordan-da
Copy link

Proposal Details

It would be nice if ResolveEmbed located here:

https://github.com/golang/go/blob/master/src/cmd/go/internal/load/pkg.go#L2093-L2101

...was externally available.

Embed directives are extremely proprietary and very tricky to resolve without a function such as this.

@gopherbot gopherbot added this to the Proposal milestone Feb 8, 2024
@bcmills
Copy link
Contributor

bcmills commented Feb 8, 2024

@jordan-da, you can use go list -json=EmbedFiles to get cmd/go to report that data.

@jordan-da
Copy link
Author

@jordan-da, you can use go list -json=EmbedFiles to get cmd/go to report that data.

That is correct, but go list must download all your modules before it can reason about it's task and I am only interested in local, inner module files.

I am building a tool that uses https://pkg.go.dev/go/build#Package to list all the files that are in a local module's package (and it's local module dependency packages). Go files is easy GoFiles.. but there is no EmbedFiles in this package like there is in go list, only EmbedPatterns.

I can use EmbedPatterns... but then I need ResolveEmbed to turn those into actual files. This is why I am asking for it ResolveEmbed to be externalized. That OR, add EmbedFiles to build.Context.

I hope that explains it better.

@bcmills bcmills added the GoCommand cmd/go label Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Incoming
Development

No branches or pull requests

3 participants