Skip to content

Distinct behaviors of -flag false and -flag=false #70

@flowrean

Description

@flowrean

For boolean flag values, there is what seems to me inconsistent behavior.

Reusing the example from the README:

package main

import (
    "fmt"
    "github.com/koding/multiconfig"
)

type Server struct {
    Enabled bool
}

func main() {
    m := multiconfig.New()
    serverConf := new(Server)
    m.MustLoad(serverConf)

    fmt.Println(serverConf.Enabled)
}

Here are a few runs of the app:

$ app         
false
$ app -enabled
true
$ app -enabled=true
true
$ app -enabled=false
false
$ app -enabled true
true
$ app -enabled false
true

I would expect the last one to be false.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions