From 20286a75a22c8889d57033377e12d953f7ce944b Mon Sep 17 00:00:00 2001 From: Sergey Grebenshchikov Date: Wed, 3 Oct 2018 18:17:20 +0200 Subject: [PATCH] Allow pointer JSON template Value --- json.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/json.go b/json.go index 0f3429a..f894bdd 100644 --- a/json.go +++ b/json.go @@ -19,7 +19,10 @@ func (fv *JSON) Help() string { // Set is flag.Value.Set func (fv *JSON) Set(v string) error { fv.Text = v - return json.Unmarshal([]byte(v), &fv.Value) + if fv.Value == nil { + return json.Unmarshal([]byte(v), &fv.Value) + } + return json.Unmarshal([]byte(v), fv.Value) } func (fv *JSON) String() string {