From 33321b2ade1cf05816ba4c97eca91acfa9793994 Mon Sep 17 00:00:00 2001 From: vCaesar Date: Sat, 10 Dec 2016 23:31:47 +0800 Subject: [PATCH] Update golint --- example/main.go | 51 +++++++++++++++++++++++++------------------------ robotgo.go | 9 +++++---- test/main.go | 21 ++++++++++---------- 3 files changed, 42 insertions(+), 39 deletions(-) diff --git a/example/main.go b/example/main.go index fb509e6..e5f818e 100644 --- a/example/main.go +++ b/example/main.go @@ -1,7 +1,8 @@ package main import ( - . "fmt" + // . "fmt" + "fmt" "github.com/go-vgo/robotgo" // "go-vgo/robotgo" @@ -39,9 +40,9 @@ func main() { robotgo.MoveMouseSmooth(100, 200) //Smooth move the mouse to 100, 200 robotgo.MoveMouseSmooth(100, 200, 1.0, 100.0) x, y := robotgo.GetMousePos() //Gets the mouse coordinates - Println("pos:", x, y) + fmt.Println("pos:", x, y) if x == 456 && y == 586 { - Println("mouse...", "586") + fmt.Println("mouse...", "586") } robotgo.MouseToggle("up") @@ -49,7 +50,7 @@ func main() { robotgo.MoveMouse(100, 200) for i := 0; i < 1080; i += 1000 { - Println(i) + fmt.Println(i) robotgo.MoveMouse(800, i) } @@ -58,43 +59,43 @@ func main() { // bit_map := robotgo.CaptureScreen() // Println("CaptureScreen...", bit_map) // gbit_map := robotgo.Capture_Screen() - gbitMap := robotgo.Capture_Screen() - // gbitMap := robotgo.BCaptureScreen() - Println("Capture_Screen...", gbitMap.Width) + // gbitMap := robotgo.Capture_Screen() + gbitMap := robotgo.BCaptureScreen() + fmt.Println("Capture_Screen...", gbitMap.Width) sx, sy := robotgo.GetScreenSize() //Gets the screen width and height - Println("...", sx, sy) + fmt.Println("...", sx, sy) color := robotgo.GetPixelColor(100, 200) //Gets the pixel color at 100, 200. - Println("color----", color, "-----------------") + fmt.Println("color----", color, "-----------------") color2 := robotgo.GetPixelColor(10, 20) //Gets the pixel color at 10, 20. - Println("color---", color2) + fmt.Println("color---", color2) // Bitmap abitMap := robotgo.CaptureScreen() //Gets all of the screen - Println("a...", abitMap) + fmt.Println("a...", abitMap) bitmap := robotgo.CaptureScreen(100, 200, 30, 40) //Gets part of the screen - Println("CaptureScreen...", bitmap) + fmt.Println("CaptureScreen...", bitmap) // Println("...", bit_map.Width, bit_map.BytesPerPixel) fx, fy := robotgo.FindBitmap(bitmap) //Searches for needle in bitmap - Println("FindBitmap------", fx, fy) + fmt.Println("FindBitmap------", fx, fy) bitpos := robotgo.GetPortion(bitmap, 10, 10, 11, 10) //Returns new bitmap object created from a portion of another - Println(bitpos) + fmt.Println(bitpos) bitstr := robotgo.TostringBitmap(bitmap) //Creates bitmap from string by bit_map - Println("bit_str...", bitstr) + fmt.Println("bit_str...", bitstr) // sbit_map := robotgo.BitmapFromstring(bit_str, 2) // Println("...", sbit_map) @@ -108,26 +109,26 @@ func main() { // open_bit := robotgo.OpenBitmap("test.tif") openbit := robotgo.OpenBitmap("test.tif") // open image bitmap - Println("open...", openbit) + fmt.Println("open...", openbit) //global event listener - Println("---please press v---") + fmt.Println("---please press v---") eve := robotgo.AddEvent("v") if eve == 0 { - Println("---you press v---", "v") + fmt.Println("---you press v---", "v") } - Println("---please press k---") + fmt.Println("---please press k---") keve := robotgo.AddEvent("k") if keve == 0 { - Println("---you press k---", "k") + fmt.Println("---you press k---", "k") } - Println("---please press left mouse button---") + fmt.Println("---please press left mouse button---") mleft := robotgo.AddEvent("mleft") if mleft == 0 { - Println("---you press left mouse button---", "mleft") + fmt.Println("---you press left mouse button---", "mleft") } // mright := robotgo.AddEvent("mright") @@ -140,15 +141,15 @@ func main() { //Window Handle abool := robotgo.ShowAlert("hello", "robotgo") //Show Alert Window if abool == 0 { - Println("ok@@@", "ok") + fmt.Println("ok@@@", "ok") } robotgo.ShowAlert("hello", "robotgo", "Ok", "Cancel") // robotgo.GetPID() mdata := robotgo.GetActive() //Get current Window Active hwnd := robotgo.GetHandle() //Get current Window Handle - Println("hwnd---", hwnd) + fmt.Println("hwnd---", hwnd) title := robotgo.GetTitle() //Get current Window title - Println("title-----", title) + fmt.Println("title-----", title) robotgo.CloseWindow() //close current Window robotgo.SetActive(mdata) //set Window Active } diff --git a/robotgo.go b/robotgo.go index 0477d57..771cb8a 100644 --- a/robotgo.go +++ b/robotgo.go @@ -30,7 +30,8 @@ package robotgo import "C" import ( - . "fmt" + // . "fmt" + "fmt" "reflect" "unsafe" // "runtime" @@ -119,8 +120,8 @@ func CaptureScreen(args ...int) C.MMBitmapRef { } //BCaptureScreen Capture the Screen -func Capture_Screen(args ...int) Bitmap { - // func BCaptureScreen(args ...int) Bitmap { +// func Capture_Screen(args ...int) Bitmap { +func BCaptureScreen(args ...int) Bitmap { var x C.size_t var y C.size_t var w C.size_t @@ -516,7 +517,7 @@ func Convert(args ...interface{}) { Try(func() { mtype = args[2].(int) }, func(e interface{}) { - Println("err:::", e) + fmt.Println("err:::", e) mtype = 1 }) //C.CString() diff --git a/test/main.go b/test/main.go index 44ec1b5..d4cb01f 100644 --- a/test/main.go +++ b/test/main.go @@ -1,6 +1,6 @@ // Copyright 2016 The go-vgo Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at -// http://www. +// https://github.com/go-vgo/robotgo/blob/master/LICENSE // // Licensed under the Apache License, Version 2.0 or the MIT license @@ -11,7 +11,8 @@ package main import ( - . "fmt" + // . "fmt" + "fmt" "github.com/go-vgo/robotgo" ) @@ -19,11 +20,11 @@ import ( func aRobotgo() { abool := robotgo.ShowAlert("test", "robotgo") if abool == 0 { - Println("ok@@@", "ok") + fmt.Println("ok@@@", "ok") } x, y := robotgo.GetMousePos() - Println("pos:", x, y) + fmt.Println("pos:", x, y) robotgo.MoveMouse(x, y) robotgo.MoveMouse(100, 200) @@ -31,14 +32,14 @@ func aRobotgo() { robotgo.MouseToggle("up") for i := 0; i < 1080; i += 1000 { - Println(i) + fmt.Println(i) robotgo.MoveMouse(800, i) } - Println(robotgo.GetPixelColor(x, y)) + fmt.Println(robotgo.GetPixelColor(x, y)) color := robotgo.GetPixelColor(100, 200) - Println("color@@@", color) + fmt.Println("color@@@", color) robotgo.TypeString("Hello World") // robotgo.KeyTap("a", "control") @@ -48,13 +49,13 @@ func aRobotgo() { robotgo.TypeString("en") abitmap := robotgo.CaptureScreen() - Println("all...", abitmap) + fmt.Println("all...", abitmap) bitmap := robotgo.CaptureScreen(10, 20, 30, 40) - Println("...", bitmap) + fmt.Println("...", bitmap) fx, fy := robotgo.FindBitmap(bitmap) - Println("FindBitmap------", fx, fy) + fmt.Println("FindBitmap------", fx, fy) robotgo.SaveBitmap(bitmap, "test.png", 1)