Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

feat: squash with prefix #288

Open
kamilsk opened this issue May 26, 2022 · 0 comments
Open

feat: squash with prefix #288

kamilsk opened this issue May 26, 2022 · 0 comments

Comments

@kamilsk
Copy link

kamilsk commented May 26, 2022

Hi! What do you think about the possibility of adding prefix support while squashing structs?

Example:

type Bitbucket struct {
	Token config.Secret `mapstructure:"token"`
}

type GitHub struct {
	Token config.Secret `mapstructure:"token"`
}

type Service struct {
	Bitbucket `mapstructure:"bitbucket,squash"`
	GitHub    `mapstructure:"github,prefix"`
}
BITBUCKET_TOKEN=secret
GITHUB_TOKEN=secret

Now, I'm using the following workaround https://github.com/octomation/maintainer/blob/af46d826f7c070347b26fa46efee6dbdee4f8be3/internal/config/tool.go#L53-L64
but want to contribute to mapstructure the possibility to add prefix if squash it has.

kamilsk added a commit to kamilsk/mapstructure that referenced this issue May 31, 2022
kamilsk added a commit to kamilsk/mapstructure that referenced this issue May 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant