aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Purkhiser <evanpurkhiser@gmail.com>2016-11-04 00:08:52 -0700
committerEvan Purkhiser <evanpurkhiser@gmail.com>2017-03-16 22:42:41 -0700
commit21d7ece211db34c6890dffa1658037ee51709e33 (patch)
treece7aa95638c611d5316e076d829700a837443a28
parent541bfc66cb1dd94c9ab4d7089adc0f31a77799d4 (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.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/group.go b/group.go
index c842a5a..f4ed687 100644
--- a/group.go
+++ b/group.go
@@ -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"`
}