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

cmd/go: clarify documentation for -overlay file additions #51348

Open
inkeliz opened this issue Feb 24, 2022 · 2 comments
Open

cmd/go: clarify documentation for -overlay file additions #51348

inkeliz opened this issue Feb 24, 2022 · 2 comments
Labels
Documentation help wanted NeedsFix
Milestone

Comments

@inkeliz
Copy link

@inkeliz inkeliz commented Feb 24, 2022

Currently, it's possible to replace files using -overlay (#39958).


However, it only have Replace options:

type OverlayJSON struct {
	Replace map[string]string
}

I would like to suggest a new field, may named as Additions:

type OverlayJSON struct {
        Additions map[string]string
	Replace map[string]string
}

That is useful when using code-generation/meta-programming. In those cases, would be possible to create new go files, or even creating files such as assembly code (.s) or creating syso files (.syso), without need to write it into the package directory. Currently, those files must be written into the package itself, but the -overlay could be used instead.

@bcmills
Copy link
Member

@bcmills bcmills commented Feb 24, 2022

Replace already does allow additions.

(CC @matloob)

@bcmills bcmills added Documentation help wanted NeedsFix labels Feb 24, 2022
@bcmills bcmills added this to the Backlog milestone Feb 24, 2022
@bcmills bcmills changed the title cmd/go: support addition of files using -overlay command cmd/go: clarify documentation for -overlay file additions Feb 24, 2022
@inkeliz
Copy link
Author

@inkeliz inkeliz commented Feb 25, 2022

I know that issues isn't for questions, but in that case I didn't find a way to "add files". I'm not sure if it only works for .go files, but I tried with assembly (.s) and syso files (.syso), it fails or not work. If the key is the "file destination", it will report that doesn't exist the file. If the "file destination" is the map value, it fails to compile (in case of assembly or, in case of syso, it compiles ignoring the syso).

I'll test again later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation help wanted NeedsFix
Projects
None yet
Development

No branches or pull requests

2 participants