Embedded struct with prefix does not work well with `kong.ConfigFlag`
- Linguagem predominante
- Go
- Estrelas
- 3.2k
- Forks
- 188
- Merge médio
- 1d 1h
- PRs com merge (30d)
- 2
Descrição
The following examples:
```go
package main
import (
"fmt"
"github.com/alecthomas/kong"
)
func main() {
var cli1 struct {
Module struct {
ConfigFile kong.ConfigFlag
Val1 int
Val2 int
} `embed:"" prefix:"module."`
// other params
}
kong.Parse(&cli1, kong.Configuration(kong.JSON))
fmt.Println(cli1)
var cli2 struct {
Module struct {
ConfigFile kong.ConfigFlag
Module struct {
Val1 int
Val2 int
} `embed:"" prefix:"module."`
} `embed:"" prefix:"module."`
// other params
}
kong.Parse(&cli2, kong.Configuration(kong.JSON))
fmt.Println(cli2)
}
```
With a config file that looks like
```json
{
"val1": 1,
"val2": 2
}
```
When run with the command
`go run main.go --module.config-file ./config.json`
Will output:
```
{{./config.json 0 0}}
{{./config.json {0 0}}}
```
Am I doing something wrong ? Or this is a bug/side effect ?
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Avaliação
Esta issue ainda não foi avaliada.