From 216bbd3939c334447d0e3ef5e58530ae78f4741a Mon Sep 17 00:00:00 2001 From: Adrian Zankich Date: Sun, 15 Dec 2013 14:29:01 -0800 Subject: [PATCH] Small refactor --- device.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/device.go b/device.go index 8a15ac98..6f5b013a 100644 --- a/device.go +++ b/device.go @@ -17,11 +17,9 @@ func NewDevice(driver interface{}, r *Robot) *Device { d := new(Device) d.Name = reflect.ValueOf(driver).Elem().FieldByName("Name").String() d.Robot = r - interval := reflect.ValueOf(driver).Elem().FieldByName("Interval").String() - if interval == "" { - interval = "0.1s" + if reflect.ValueOf(driver).Elem().FieldByName("Interval").String() == "" { + reflect.ValueOf(driver).Elem().FieldByName("Interval").SetString("0.1s") } - reflect.ValueOf(driver).Elem().FieldByName("Interval").SetString(interval) d.Driver = driver return d }