conf icon indicating copy to clipboard operation
conf copied to clipboard

flags with string literal "null" get skipped

Open abraithwaite opened this issue 8 years ago • 2 comments

This was unexpected behavior for me. I imagine it has to do with JSON/yaml parsing support.

Perhaps documentation is all that's needed.

package main

import (
        "fmt"

        "github.com/segmentio/conf"
)

type config struct {
        Name string `conf:"name" help:"set me please"`
}

func main() {
        c := config{}
        conf.Load(&c)
        fmt.Println(c)
}
abraithwaite at alan-mbpr in ~GOPATH/src/github.com/segmentio
10:57:05 $ go run play.go -name null
{}

abraithwaite avatar Sep 08 '17 17:09 abraithwaite

It does indeed.

Was your expectation that the name would be set to the string null?

achille-roussel avatar Dec 07 '17 03:12 achille-roussel

For flags at least yeah. Maybe this is also related to the other issue with : in env vars and cli args?

abraithwaite avatar Dec 07 '17 06:12 abraithwaite