summaryrefslogtreecommitdiff
path: root/example_test.go
diff options
context:
space:
mode:
authorAlex Flint <[email protected]>2019-10-21 23:40:36 -0700
committerGitHub <[email protected]>2019-10-21 23:40:36 -0700
commitc0c7a3ba8a1854cd85e65cca4f0e2028698a0738 (patch)
tree4f107812eb75ca8fc0c9f11ca199205b9ef31cd9 /example_test.go
parent873f3c2cf4ec11ac4cab84a6ebaf61f695ab8b68 (diff)
parente0fc08f7ad001371541770efcc43cf840288fee8 (diff)
Merge pull request #91 from alexflint/defaultsv1.2.0
Allow default values in struct tags
Diffstat (limited to 'example_test.go')
-rw-r--r--example_test.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/example_test.go b/example_test.go
index 2188253..f71fbeb 100644
--- a/example_test.go
+++ b/example_test.go
@@ -30,12 +30,11 @@ func Example_defaultValues() {
os.Args = split("./example")
var args struct {
- Foo string
+ Foo string `default:"abc"`
}
- args.Foo = "default value"
MustParse(&args)
fmt.Println(args.Foo)
- // output: default value
+ // output: abc
}
// This example demonstrates arguments that are required