Skip to content

Setting ZERO value conflicts with flag processing libraries.  #2

@lindemannrichard

Description

@lindemannrichard

Setting ZERO value conflicts with flag processing libraries.

Imagine that you want your app to support both flags and env vars.
First you want your flags to be processd by flags package and then by env package.

Your library will overwrite all vars which were not providen through environment with zero values.

Are you considering this case?

Example which will not work:

var appFlags = Flags{}

func init() {

    // parse command line
    if _, err := flags.Parse(&appFlags); err != nil {
        os.Exit(1)
    }

    // parse enviroment
    if err := env.Process(&appFlags); err != nil {
        fmt.Println(err)
        os.Exit(1)
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions