From 3540ce7bd1e0ab733c4d65defcd1814abe58affc Mon Sep 17 00:00:00 2001 From: deadprogram Date: Thu, 1 Sep 2016 13:32:40 +0200 Subject: [PATCH] docs: go fmt files that needed it from recent changes Signed-off-by: deadprogram --- examples/ardrone_face_tracking.go | 2 +- examples/bebop.go | 2 +- examples/bebop_ps3_video.go | 2 +- examples/ble_battery.go | 2 +- examples/chip_grove_accelerometer.go | 2 +- examples/chip_grove_lcd.go | 2 +- examples/chip_mpu6050.go | 2 +- examples/edison_button_led.go | 44 ++++++++-------- examples/edison_button_led_api.go | 48 +++++++++--------- examples/firmata_integration.go | 2 +- examples/firmata_mpl115a2.go | 2 +- examples/firmata_rgb_led.go | 2 +- examples/minidrone.go | 2 +- examples/minidrone_ps3.go | 2 +- examples/ollie.go | 2 +- examples/opencv_face_detect.go | 2 +- examples/opencv_window.go | 2 +- examples/sphero_dpad.go | 76 ++++++++++++++-------------- platforms/joystick/events.go | 54 ++++++++++---------- platforms/sphero/sphero_driver.go | 4 +- 20 files changed, 128 insertions(+), 128 deletions(-) diff --git a/examples/ardrone_face_tracking.go b/examples/ardrone_face_tracking.go index 78ccc4e96..8d60c0409 100644 --- a/examples/ardrone_face_tracking.go +++ b/examples/ardrone_face_tracking.go @@ -7,10 +7,10 @@ import ( "runtime" "time" - cv "github.com/lazywei/go-opencv/opencv" "github.com/hybridgroup/gobot" "github.com/hybridgroup/gobot/platforms/ardrone" "github.com/hybridgroup/gobot/platforms/opencv" + cv "github.com/lazywei/go-opencv/opencv" ) func main() { diff --git a/examples/bebop.go b/examples/bebop.go index fd5e55a8a..ead71d796 100644 --- a/examples/bebop.go +++ b/examples/bebop.go @@ -20,7 +20,7 @@ func main() { }) }) - drone.HullProtection(true) + drone.HullProtection(true) drone.TakeOff() } diff --git a/examples/bebop_ps3_video.go b/examples/bebop_ps3_video.go index 8040c608c..b4a440ef8 100644 --- a/examples/bebop_ps3_video.go +++ b/examples/bebop_ps3_video.go @@ -71,7 +71,7 @@ func main() { for { if _, err := video.Write(<-drone.Video()); err != nil { fmt.Println(err) - return + return } } }() diff --git a/examples/ble_battery.go b/examples/ble_battery.go index 6951a3ead..a00144220 100644 --- a/examples/ble_battery.go +++ b/examples/ble_battery.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "time" "os" + "time" "github.com/hybridgroup/gobot" "github.com/hybridgroup/gobot/platforms/ble" diff --git a/examples/chip_grove_accelerometer.go b/examples/chip_grove_accelerometer.go index eeca94ec6..b8e95f4b5 100644 --- a/examples/chip_grove_accelerometer.go +++ b/examples/chip_grove_accelerometer.go @@ -5,8 +5,8 @@ import ( "time" "github.com/hybridgroup/gobot" - "github.com/hybridgroup/gobot/platforms/i2c" "github.com/hybridgroup/gobot/platforms/chip" + "github.com/hybridgroup/gobot/platforms/i2c" ) func main() { diff --git a/examples/chip_grove_lcd.go b/examples/chip_grove_lcd.go index dcf9bee04..09ca8864e 100644 --- a/examples/chip_grove_lcd.go +++ b/examples/chip_grove_lcd.go @@ -4,8 +4,8 @@ import ( "time" "github.com/hybridgroup/gobot" - "github.com/hybridgroup/gobot/platforms/i2c" "github.com/hybridgroup/gobot/platforms/chip" + "github.com/hybridgroup/gobot/platforms/i2c" ) func main() { diff --git a/examples/chip_mpu6050.go b/examples/chip_mpu6050.go index 1e0605e70..d9096f701 100644 --- a/examples/chip_mpu6050.go +++ b/examples/chip_mpu6050.go @@ -5,8 +5,8 @@ import ( "time" "github.com/hybridgroup/gobot" + "github.com/hybridgroup/gobot/platforms/chip" "github.com/hybridgroup/gobot/platforms/i2c" - "github.com/hybridgroup/gobot/platforms/chip" ) func main() { diff --git a/examples/edison_button_led.go b/examples/edison_button_led.go index 351277319..42e02ab6d 100644 --- a/examples/edison_button_led.go +++ b/examples/edison_button_led.go @@ -1,35 +1,35 @@ package main import ( - "github.com/hybridgroup/gobot" - "github.com/hybridgroup/gobot/platforms/gpio" - "github.com/hybridgroup/gobot/platforms/intel-iot/edison" + "github.com/hybridgroup/gobot" + "github.com/hybridgroup/gobot/platforms/gpio" + "github.com/hybridgroup/gobot/platforms/intel-iot/edison" ) func main() { - gbot := gobot.NewGobot() + gbot := gobot.NewGobot() - e := edison.NewEdisonAdaptor("edison") + e := edison.NewEdisonAdaptor("edison") - button := gpio.NewButtonDriver(e, "myButton", "2") - led := gpio.NewLedDriver(e, "myLed", "4") + button := gpio.NewButtonDriver(e, "myButton", "2") + led := gpio.NewLedDriver(e, "myLed", "4") - work := func() { - button.On(gpio.ButtonPush, func(data interface{}) { - led.On() - }) - button.On(gpio.ButtonRelease, func(data interface{}) { - led.Off() - }) - } + work := func() { + button.On(gpio.ButtonPush, func(data interface{}) { + led.On() + }) + button.On(gpio.ButtonRelease, func(data interface{}) { + led.Off() + }) + } - robot := gobot.NewRobot("buttonBot", - []gobot.Connection{e}, - []gobot.Device{led, button}, - work, - ) + robot := gobot.NewRobot("buttonBot", + []gobot.Connection{e}, + []gobot.Device{led, button}, + work, + ) - gbot.AddRobot(robot) + gbot.AddRobot(robot) - gbot.Start() + gbot.Start() } diff --git a/examples/edison_button_led_api.go b/examples/edison_button_led_api.go index f09355ef8..0a1a6dfb6 100644 --- a/examples/edison_button_led_api.go +++ b/examples/edison_button_led_api.go @@ -1,38 +1,38 @@ package main import ( - "github.com/hybridgroup/gobot" - "github.com/hybridgroup/gobot/platforms/gpio" - "github.com/hybridgroup/gobot/platforms/intel-iot/edison" + "github.com/hybridgroup/gobot" + "github.com/hybridgroup/gobot/platforms/gpio" + "github.com/hybridgroup/gobot/platforms/intel-iot/edison" - "github.com/hybridgroup/gobot/api" + "github.com/hybridgroup/gobot/api" ) func main() { - gbot := gobot.NewGobot() - api.NewAPI(gbot).Start() + gbot := gobot.NewGobot() + api.NewAPI(gbot).Start() - e := edison.NewEdisonAdaptor("edison") + e := edison.NewEdisonAdaptor("edison") - button := gpio.NewButtonDriver(e, "myButton", "2") - led := gpio.NewLedDriver(e, "myLed", "4") + button := gpio.NewButtonDriver(e, "myButton", "2") + led := gpio.NewLedDriver(e, "myLed", "4") - work := func() { - button.On(gpio.ButtonPush, func(data interface{}) { - led.On() - }) - button.On(gpio.ButtonRelease, func(data interface{}) { - led.Off() - }) - } + work := func() { + button.On(gpio.ButtonPush, func(data interface{}) { + led.On() + }) + button.On(gpio.ButtonRelease, func(data interface{}) { + led.Off() + }) + } - robot := gobot.NewRobot("buttonBot", - []gobot.Connection{e}, - []gobot.Device{led, button}, - work, - ) + robot := gobot.NewRobot("buttonBot", + []gobot.Connection{e}, + []gobot.Device{led, button}, + work, + ) - gbot.AddRobot(robot) + gbot.AddRobot(robot) - gbot.Start() + gbot.Start() } diff --git a/examples/firmata_integration.go b/examples/firmata_integration.go index 54fa592d8..c7abdb194 100644 --- a/examples/firmata_integration.go +++ b/examples/firmata_integration.go @@ -1,8 +1,8 @@ package main import ( - "time" "fmt" + "time" "github.com/hybridgroup/gobot" "github.com/hybridgroup/gobot/platforms/firmata" diff --git a/examples/firmata_mpl115a2.go b/examples/firmata_mpl115a2.go index 6775d129e..d03416334 100644 --- a/examples/firmata_mpl115a2.go +++ b/examples/firmata_mpl115a2.go @@ -31,4 +31,4 @@ func main() { gbot.AddRobot(robot) gbot.Start() -} \ No newline at end of file +} diff --git a/examples/firmata_rgb_led.go b/examples/firmata_rgb_led.go index 2b205db84..bb2c1be3c 100644 --- a/examples/firmata_rgb_led.go +++ b/examples/firmata_rgb_led.go @@ -4,8 +4,8 @@ import ( "time" "github.com/hybridgroup/gobot" - "github.com/hybridgroup/gobot/platforms/gpio" "github.com/hybridgroup/gobot/platforms/firmata" + "github.com/hybridgroup/gobot/platforms/gpio" ) func main() { diff --git a/examples/minidrone.go b/examples/minidrone.go index 9cf6c2778..287fdd9fd 100644 --- a/examples/minidrone.go +++ b/examples/minidrone.go @@ -1,8 +1,8 @@ package main import ( - "os" "fmt" + "os" "time" "github.com/hybridgroup/gobot" diff --git a/examples/minidrone_ps3.go b/examples/minidrone_ps3.go index 69b676f6a..fd18080aa 100644 --- a/examples/minidrone_ps3.go +++ b/examples/minidrone_ps3.go @@ -2,8 +2,8 @@ package main import ( "math" - "time" "os" + "time" "github.com/hybridgroup/gobot" "github.com/hybridgroup/gobot/platforms/ble" diff --git a/examples/ollie.go b/examples/ollie.go index f5a16ab5e..808afb871 100644 --- a/examples/ollie.go +++ b/examples/ollie.go @@ -3,7 +3,7 @@ package main import ( "os" "time" - + "github.com/hybridgroup/gobot" "github.com/hybridgroup/gobot/platforms/ble" ) diff --git a/examples/opencv_face_detect.go b/examples/opencv_face_detect.go index 13268d947..fedbe74c5 100644 --- a/examples/opencv_face_detect.go +++ b/examples/opencv_face_detect.go @@ -5,9 +5,9 @@ import ( "runtime" "time" - cv "github.com/lazywei/go-opencv/opencv" "github.com/hybridgroup/gobot" "github.com/hybridgroup/gobot/platforms/opencv" + cv "github.com/lazywei/go-opencv/opencv" ) func main() { diff --git a/examples/opencv_window.go b/examples/opencv_window.go index 757759d80..3ab260e13 100644 --- a/examples/opencv_window.go +++ b/examples/opencv_window.go @@ -1,9 +1,9 @@ package main import ( - cv "github.com/lazywei/go-opencv/opencv" "github.com/hybridgroup/gobot" "github.com/hybridgroup/gobot/platforms/opencv" + cv "github.com/lazywei/go-opencv/opencv" ) func main() { diff --git a/examples/sphero_dpad.go b/examples/sphero_dpad.go index 4a80ca236..c5a6fcd22 100644 --- a/examples/sphero_dpad.go +++ b/examples/sphero_dpad.go @@ -1,46 +1,46 @@ package main import ( - "time" + "time" - "github.com/hybridgroup/gobot" - "github.com/hybridgroup/gobot/api" - "github.com/hybridgroup/gobot/platforms/sphero" + "github.com/hybridgroup/gobot" + "github.com/hybridgroup/gobot/api" + "github.com/hybridgroup/gobot/platforms/sphero" ) func main() { - gbot := gobot.NewGobot() - a := api.NewAPI(gbot) - a.Start() - - conn := sphero.NewSpheroAdaptor("Sphero", "/dev/rfcomm0") - ball := sphero.NewSpheroDriver(conn, "sphero") - - robot := gobot.NewRobot("sphero-dpad", - []gobot.Connection{conn}, - []gobot.Device{ball}, - ) - - robot.AddCommand("move", func(params map[string]interface{}) interface{} { - direction := params["direction"].(string) - - switch direction { - case "up": - ball.Roll(100, 0) - case "down": - ball.Roll(100, 180) - case "left": - ball.Roll(100, 270) - case "right": - ball.Roll(100, 90) - } - - time.Sleep(2 * time.Second) - ball.Stop() - return "ok" - }) - - gbot.AddRobot(robot) - - gbot.Start() + gbot := gobot.NewGobot() + a := api.NewAPI(gbot) + a.Start() + + conn := sphero.NewSpheroAdaptor("Sphero", "/dev/rfcomm0") + ball := sphero.NewSpheroDriver(conn, "sphero") + + robot := gobot.NewRobot("sphero-dpad", + []gobot.Connection{conn}, + []gobot.Device{ball}, + ) + + robot.AddCommand("move", func(params map[string]interface{}) interface{} { + direction := params["direction"].(string) + + switch direction { + case "up": + ball.Roll(100, 0) + case "down": + ball.Roll(100, 180) + case "left": + ball.Roll(100, 270) + case "right": + ball.Roll(100, 90) + } + + time.Sleep(2 * time.Second) + ball.Stop() + return "ok" + }) + + gbot.AddRobot(robot) + + gbot.Start() } diff --git a/platforms/joystick/events.go b/platforms/joystick/events.go index 427260777..f5b5383a7 100644 --- a/platforms/joystick/events.go +++ b/platforms/joystick/events.go @@ -27,66 +27,66 @@ const ( Right = "right" // square button press event SquarePress = "square_press" - // square button release event + // square button release event SquareRelease = "square_release" // circle button press event CirclePress = "circle_press" - // circle button release event + // circle button release event CircleRelease = "circle_release" // triangle button press event TrianglePress = "triangle_press" - // triangle button release event + // triangle button release event TriangleRelease = "triangle_release" - // X button press event + // X button press event XPress = "x_press" - // X button release event + // X button release event XRelease = "x_release" - // share button press event + // share button press event SharePress = "share_press" - // share button relase event + // share button relase event ShareRelease = "share_release" // options button press event OptionsPress = "options_press" - // options button release event + // options button release event OptionsRelease = "options_release" // home button press event HomePress = "home_press" - // home button release event + // home button release event HomeRelease = "home_release" - // start button press event + // start button press event StartPress = "start_press" - // start button release event + // start button release event StartRelease = "start_release" - // rt button press event + // rt button press event RTPress = "rt_press" - // rt button release event + // rt button release event RTRelease = "rt_release" - // lt button press event + // lt button press event LTPress = "lt_press" - // lt button release event + // lt button release event LTRelease = "lt_release" - // Y button press event + // Y button press event YPress = "y_press" - // Y button release event + // Y button release event YRelease = "y_release" - // A button press event + // A button press event APress = "a_press" - // A button release event + // A button release event ARelease = "a_release" - // B button press event + // B button press event BPress = "b_press" - // B button release event + // B button release event BRelease = "b_release" - // rb button press event + // rb button press event RBPress = "rb_press" - // rb button release event + // rb button release event RBRelease = "rb_release" - // lb button press event + // lb button press event LBPress = "lb_press" - // lb button release event + // lb button release event LBRelease = "lb_release" - // back button press event + // back button press event BackPress = "back_press" - // back button release event + // back button release event BackRelease = "back_release" ) diff --git a/platforms/sphero/sphero_driver.go b/platforms/sphero/sphero_driver.go index ae5fb41da..8c94c55af 100644 --- a/platforms/sphero/sphero_driver.go +++ b/platforms/sphero/sphero_driver.go @@ -11,11 +11,11 @@ import ( const ( // event when error encountered - Error = "error" + Error = "error" // event when sensor data is received SensorData = "sensordata" // event when collision is detected - Collision = "collision" + Collision = "collision" ) type packet struct {