Skip to content

Inconsistency in default value override #203

@gobsej

Description

@gobsej

Reference

I am building a bunch of independent microservices of which everyone uses the same set of Arguments (some with default values).
I then override some of the default values in the services (because some services need different default values than the majority) before parsing the arguments, to get an idea:

var args Args

func main() {
	// override defaults
	args.SomeBool = false
	args.SomeString = "override"
	
	arg.MustParse(&args)

The Args struct is defined globally for everyone:

type Args struct {
	SomeString string `arg:"--some-string" default:"test"`
	SomeBool   bool   `arg:"--some-bool" default:"true"`
	.
	.
	.
}

The actual Issue

While overriding bool values I noticed that values that have a default value of "true" in the struct, can't be overridden to "false" but overriding a "false" default value to "true" works.
Seems a bit strange to handle this differently, is this on purpose?

Metadata

Metadata

Assignees

No one assigned

    Labels

    v2-ideasPossible inclusion in V2

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions