Using `env` with `cmd` does not appear to work as expected.
Hello all!
Playground demonstrating the issue: https://go.dev/play/p/LFPIRwbTCqc
If we had a struct like:
var CLI struct {
One CmdOne `cmd:"" env:"CMD"`
Two CmdTwo `cmd:"" env:"CMD"`
}
Then env CMD=one cli still fails with expected one of "one", "two" which doesn't seem correct to me. Perhaps I'm missing something in the usage?
However, cli one or cli two works as expected.
Thanks for your time!
PS:
I know we can do something like this, but it seems to defeat the purpose of env:"X":
if cmd := os.Getenv("CMD"); cmd != "" {
os.Args = append([]string{os.Args[0], cmd}, os.Args[1:]...)
}
If using env with cmd is not intended to be supported, could we get Kong to produce an error when both are specified?
env is not supported, correct. Kong currently doesn't error for any use of unsupported tags. I think doing that robustly would require some thought.
Ah, I haven't dug into the code, but sounds like it's more involved than just checking if cmd and env then error.
Thanks very much for the reply. Love the package!