segmentio / conf

Go package for loading program configuration from multiple sources.
MIT License
87 stars 10 forks source link

flags with string literal "null" get skipped #17

Open abraithwaite opened 7 years ago

abraithwaite commented 7 years ago

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
{}
achille-roussel commented 6 years ago

It does indeed.

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

abraithwaite commented 6 years ago

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