From 21d7ece211db34c6890dffa1658037ee51709e33 Mon Sep 17 00:00:00 2001 From: Evan Purkhiser Date: Fri, 4 Nov 2016 00:08:52 -0700 Subject: 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. --- group.go | 6 +++--- 1 file 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"` } -- cgit v1.2.3