diff options
author | Evan Purkhiser <evanpurkhiser@gmail.com> | 2016-11-04 00:08:52 -0700 |
---|---|---|
committer | Evan Purkhiser <evanpurkhiser@gmail.com> | 2017-03-16 22:42:41 -0700 |
commit | 21d7ece211db34c6890dffa1658037ee51709e33 (patch) | |
tree | ce7aa95638c611d5316e076d829700a837443a28 | |
parent | 541bfc66cb1dd94c9ab4d7089adc0f31a77799d4 (diff) |
Correct some Action fields to be pointers
Since we specify omitempty on all Action fields it's important that
fields whose empty values are valid values to marshal, we must use
pointer types, so that the empty value is nil, not the empty value of
the type
For example, prior to this change you could not specify On: false and
have it correctly be marshaled into a Action JSON.
-rw-r--r-- | group.go | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -20,9 +20,9 @@ type Action struct { Colormode string `json:"colormode,omitempty"` Ct int `json:"ct,omitempty"` Effect string `json:"effect,omitempty"` - Hue int `json:"hue,omitempty"` - On bool `json:"on,omitempty"` - Sat int `json:"sat,omitempty"` + Hue *int `json:"hue,omitempty"` + On *bool `json:"on,omitempty"` + Sat *int `json:"sat,omitempty"` XY []float64 `json:"xy,omitempty"` Scene string `json:"scene,omitempty"` } |