Skip to content

Commit

Permalink
Allow pointer JSON template Value
Browse files Browse the repository at this point in the history
  • Loading branch information
sgreben committed Oct 3, 2018
1 parent e5da499 commit 20286a7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion json.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 20286a7

Please sign in to comment.