From dd073ccc11b2bc66c3a7b2616162a9a6c53b11b9 Mon Sep 17 00:00:00 2001 From: Prashant Gupta Date: Tue, 26 Mar 2019 19:50:09 -0700 Subject: [PATCH] using go mod --- .travis.yml | 18 ++++++ Makefile | 5 +- glide.lock | 94 ------------------------------- glide.yaml | 13 ----- go.mod | 18 ++++++ go.sum | 64 +++++++++++++++++++++ pkg/mousemover/mouseMover_test.go | 20 +++++++ 7 files changed, 124 insertions(+), 108 deletions(-) create mode 100644 .travis.yml delete mode 100644 glide.lock delete mode 100644 glide.yaml create mode 100644 go.mod create mode 100644 go.sum create mode 100644 pkg/mousemover/mouseMover_test.go diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..a988467 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,18 @@ +language: go + +go: + - 1.11.x + +env: + - GO111MODULE=on + +# Don't email me the results of the test runs. +notifications: + email: false + +before_install: + - export PATH=$PATH:$HOME/gopath/bin + - go get -t -v ./... + +script: + - go test -v -failfast -race ./... \ No newline at end of file diff --git a/Makefile b/Makefile index c65423f..ffa3037 100644 --- a/Makefile +++ b/Makefile @@ -1,2 +1,5 @@ start: - go run cmd/main.go \ No newline at end of file + go run cmd/main.go + +test: + go test -v -race -failfast ./... \ No newline at end of file diff --git a/glide.lock b/glide.lock deleted file mode 100644 index 8794a16..0000000 --- a/glide.lock +++ /dev/null @@ -1,94 +0,0 @@ -hash: 0e9d554853b2c3ed23ba323715540d961c06465a1a125959a698d6162e17f91d -updated: 2019-03-22T15:34:56.64781-07:00 -imports: -- name: github.com/BurntSushi/xgb - version: 27f122750802c950b2c869a5b63dafcf590ced95 - subpackages: - - shape - - xinerama - - xproto -- name: github.com/BurntSushi/xgbutil - version: f7c97cef3b4e6c88280a5a7091c3314e815ca243 - subpackages: - - ewmh - - xevent - - xprop -- name: github.com/deckarep/gosx-notifier - version: e127226297fb751aa3b582db5e92361fcbfc5a6c -- name: github.com/getlantern/context - version: c447772a6520c1a3ae6294a7df725ee08230f14e -- name: github.com/getlantern/errors - version: e24b7f4ff7c70be59bbefca6b7695d68cda8b399 -- name: github.com/getlantern/golog - version: cca714f7feb5df8e455f409b549d384441ac4578 -- name: github.com/getlantern/hex - version: 083fba3033ad473db3dd31c9bb368473d37581a7 -- name: github.com/getlantern/hidden - version: d52a649ab33af200943bb599898dbdcfdbc94cb7 -- name: github.com/getlantern/ops - version: 37353306c90844c8e0591956f56611f46299d202 -- name: github.com/getlantern/systray - version: 26d5b920200dbc1869c4bfde4571497082f83caa - subpackages: - - example/icon -- name: github.com/go-ole/go-ole - version: 97b6244175ae18ea6eef668034fd6565847501c9 - subpackages: - - oleutil -- name: github.com/go-stack/stack - version: 2fee6af1a9795aafbe0253a0cfbdf668e1fb8a9a -- name: github.com/go-vgo/robotgo - version: 193b4935d4b146c729d763c2c59a0d3e7f3cee8a - subpackages: - - clipboard -- name: github.com/konsorten/go-windows-terminal-sequences - version: f55edac94c9bbba5d6182a4be46d86a2c9b5b50e -- name: github.com/lxn/win - version: 0040366d745006bbf7528ac96de2de375846aa79 -- name: github.com/otiai10/gosseract - version: d442e510d0b37ec1f332a61a04e323ecee91d0cb -- name: github.com/oxtoacart/bpool - version: 8c4636f812cc8920c26e2002b988c878b1fd6f5e -- name: github.com/prashantgupta24/activity-tracker - version: d60ddb4a3211e471b1a3fcd9b5dec960a453c79c - subpackages: - - internal/pkg/logging - - internal/pkg/mouse - - internal/pkg/service - - pkg/activity - - pkg/tracker - - src/activity - - src/mouse -- name: github.com/robotn/gohook - version: a7a38946710e764b00839160e13a92b09e40e96a -- name: github.com/shirou/gopsutil - version: 381f7cc0bf4ccb60157fd5c6eaabfdfc681e6c2f - subpackages: - - cpu - - host - - internal/common - - mem - - net - - process -- name: github.com/shirou/w32 - version: bb4de0191aa41b5507caa14b0650cdbddcd9280b -- name: github.com/sirupsen/logrus - version: dae0fa8d5b0c810a8ab733fbd5510c7cae84eca4 -- name: github.com/StackExchange/wmi - version: e0a55b97c70558c92ce14085e41b35a894e93d3d -- name: github.com/vcaesar/imgo - version: 13af122cf2fa6117048933e141c0b52f19116ca6 -- name: golang.org/x/crypto - version: b7391e95e576cacdcdd422573063bc057239113d - subpackages: - - ssh/terminal -- name: golang.org/x/image - version: 3fc05d484e9f77dd51816890e05f2602e4ca4d65 - subpackages: - - bmp -- name: golang.org/x/sys - version: f49334f85ddcf0f08d7fb6dd7363e9e6d6b777eb - subpackages: - - unix - - windows -testImports: [] diff --git a/glide.yaml b/glide.yaml deleted file mode 100644 index 6a9a345..0000000 --- a/glide.yaml +++ /dev/null @@ -1,13 +0,0 @@ -package: github.com/prashantgupta24/automatic-mouse-mover -import: -- package: github.com/deckarep/gosx-notifier -- package: github.com/getlantern/systray - subpackages: - - example/icon -- package: github.com/go-vgo/robotgo - version: ^0.80.0 -- package: github.com/prashantgupta24/activity-tracker - version: ^0.0.1 - subpackages: - - src/activity - - src/mouse diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..e7b03ce --- /dev/null +++ b/go.mod @@ -0,0 +1,18 @@ +module github.com/prashantgupta24/automatic-mouse-mover + +require ( + github.com/deckarep/gosx-notifier v0.0.0-20180201035817-e127226297fb + github.com/getlantern/context v0.0.0-20190109183933-c447772a6520 // indirect + github.com/getlantern/errors v0.0.0-20190325191628-abdb3e3e36f7 // indirect + github.com/getlantern/golog v0.0.0-20170508214112-cca714f7feb5 // indirect + github.com/getlantern/hex v0.0.0-20160523043825-083fba3033ad // indirect + github.com/getlantern/hidden v0.0.0-20190325191715-f02dbb02be55 // indirect + github.com/getlantern/ops v0.0.0-20190325191751-d70cb0d6f85f // indirect + github.com/getlantern/systray v0.0.0-20190131073753-26d5b920200d + github.com/go-stack/stack v1.8.0 // indirect + github.com/go-vgo/robotgo v0.0.0-20190321150332-9d92e0f852ca + github.com/oxtoacart/bpool v0.0.0-20190227141107-8c4636f812cc // indirect + github.com/prashantgupta24/activity-tracker v0.3.1 + github.com/sirupsen/logrus v1.4.0 // indirect + github.com/stretchr/testify v1.2.2 +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..86d6c83 --- /dev/null +++ b/go.sum @@ -0,0 +1,64 @@ +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802 h1:1BDTz0u9nC3//pOCMdNH+CiXJVYJh5UQNCOBG7jbELc= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/BurntSushi/xgbutil v0.0.0-20160919175755-f7c97cef3b4e h1:4ZrkT/RzpnROylmoQL57iVUL57wGKTR5O6KpVnbm2tA= +github.com/BurntSushi/xgbutil v0.0.0-20160919175755-f7c97cef3b4e/go.mod h1:uw9h2sd4WWHOPdJ13MQpwK5qYWKYDumDqxWWIknEQ+k= +github.com/StackExchange/wmi v0.0.0-20181212234831-e0a55b97c705 h1:UUppSQnhf4Yc6xGxSkoQpPhb7RVzuv5Nb1mwJ5VId9s= +github.com/StackExchange/wmi v0.0.0-20181212234831-e0a55b97c705/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/deckarep/gosx-notifier v0.0.0-20180201035817-e127226297fb h1:6S+TKObz6+Io2c8IOkcbK4Sz7nj6RpEVU7TkvmsZZcw= +github.com/deckarep/gosx-notifier v0.0.0-20180201035817-e127226297fb/go.mod h1:wf3nKtOnQqCp7kp9xB7hHnNlZ6m3NoiOxjrB9hFRq4Y= +github.com/getlantern/context v0.0.0-20190109183933-c447772a6520 h1:NRUJuo3v3WGC/g5YiyF790gut6oQr5f3FBI88Wv0dx4= +github.com/getlantern/context v0.0.0-20190109183933-c447772a6520/go.mod h1:L+mq6/vvYHKjCX2oez0CgEAJmbq1fbb/oNJIWQkBybY= +github.com/getlantern/errors v0.0.0-20190325191628-abdb3e3e36f7 h1:6uJ+sZ/e03gkbqZ0kUG6mfKoqDb4XMAzMIwlajq19So= +github.com/getlantern/errors v0.0.0-20190325191628-abdb3e3e36f7/go.mod h1:l+xpFBrCtDLpK9qNjxs+cHU6+BAdlBaxHqikB6Lku3A= +github.com/getlantern/golog v0.0.0-20170508214112-cca714f7feb5 h1:Okd7vkn9CfIgDBj1ST/vtBTCfD/kxIhYD412K+FRKPc= +github.com/getlantern/golog v0.0.0-20170508214112-cca714f7feb5/go.mod h1:Vwx1Cg64gCdIalad44uvQsKZw6LsVczIKZrUBStEjVw= +github.com/getlantern/hex v0.0.0-20160523043825-083fba3033ad h1:L/UatDVr6opOJnZdZnGwhFXjoIUwO6RHULxPyzb60L4= +github.com/getlantern/hex v0.0.0-20160523043825-083fba3033ad/go.mod h1:dD3CgOrwlzca8ed61CsZouQS5h5jIzkK9ZWrTcf0s+o= +github.com/getlantern/hidden v0.0.0-20190325191715-f02dbb02be55 h1:XYzSdCbkzOC0FDNrgJqGRo8PCMFOBFL9py72DRs7bmc= +github.com/getlantern/hidden v0.0.0-20190325191715-f02dbb02be55/go.mod h1:6mmzY2kW1TOOrVy+r41Za2MxXM+hhqTtY3oBKd2AgFA= +github.com/getlantern/ops v0.0.0-20190325191751-d70cb0d6f85f h1:wrYrQttPS8FHIRSlsrcuKazukx/xqO/PpLZzZXsF+EA= +github.com/getlantern/ops v0.0.0-20190325191751-d70cb0d6f85f/go.mod h1:D5ao98qkA6pxftxoqzibIBBrLSUli+kYnJqrgBf9cIA= +github.com/getlantern/systray v0.0.0-20190131073753-26d5b920200d h1:4P2eDMAoQcQoWIIKCNIkuVbQb+paRmpMxVXVfbs7B4U= +github.com/getlantern/systray v0.0.0-20190131073753-26d5b920200d/go.mod h1:7Splj4WBQSps8jODnMgrIV6goKL0N1HR+mhCAEVWlA0= +github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI= +github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM= +github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-vgo/robotgo v0.0.0-20190321150332-9d92e0f852ca h1:TUqm5e4QD14kygf1AkXLxcn6sBdhh2SuEjPXaFrwEis= +github.com/go-vgo/robotgo v0.0.0-20190321150332-9d92e0f852ca/go.mod h1:btNdXfFVS5B5p/iqUKRaaSuJfETYNbMv6wG8fL2onK0= +github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/lxn/win v0.0.0-20190226192825-50e22abd4ff9 h1:7noriXA0DUpF8QGGBsuGCRn+LLs7uR0MlDfVccQuvEg= +github.com/lxn/win v0.0.0-20190226192825-50e22abd4ff9/go.mod h1:jACzEp9RV7NhfPJQkiCNTteU4nkZZVlvkNpYtVOZPfE= +github.com/otiai10/gosseract v2.2.1+incompatible h1:Ry5ltVdpdp4LAa2bMjsSJH34XHVOV7XMi41HtzL8X2I= +github.com/otiai10/gosseract v2.2.1+incompatible/go.mod h1:XrzWItCzCpFRZ35n3YtVTgq5bLAhFIkascoRo8G32QE= +github.com/oxtoacart/bpool v0.0.0-20190227141107-8c4636f812cc h1:uhnyuvDwdKbjemAXHKsiEZOPagHim2nRjMcazH1g26A= +github.com/oxtoacart/bpool v0.0.0-20190227141107-8c4636f812cc/go.mod h1:L3UMQOThbttwfYRNFOWLLVXMhk5Lkio4GGOtw5UrxS0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prashantgupta24/activity-tracker v0.3.1 h1:+jKFqnve2316ZgWgrYgd+go+ocphaN3EgfeEMfW7lhA= +github.com/prashantgupta24/activity-tracker v0.3.1/go.mod h1:hZjTk+hYxhxGutmSNiFTk3+OebO3RTNki5gA/5hIPkM= +github.com/robotn/gohook v0.0.0-20190315174547-bc414970f3d6 h1:XTKPqoPYwgasmAWhtpolldqBpnbpgH6iAtQPReXiywA= +github.com/robotn/gohook v0.0.0-20190315174547-bc414970f3d6/go.mod h1:YD5RyCnUEY2xqtkkgeQVZ31UAfAnVPwUxpTE5cwSXg4= +github.com/shirou/gopsutil v0.0.0-20190131151121-071446942108 h1:XXgDK65TPH+Qbo2sdYHldM5avclwThBXVYZHxroFkTQ= +github.com/shirou/gopsutil v0.0.0-20190131151121-071446942108/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 h1:udFKJ0aHUL60LboW/A+DfgoHVedieIzIXE8uylPue0U= +github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc= +github.com/sirupsen/logrus v1.4.0 h1:yKenngtzGh+cUSSh6GWbxW2abRqhYUSR/t/6+2QqNvE= +github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/vcaesar/imgo v0.0.0-20181209162409-13af122cf2fa h1:kOg2u5TN+l2IBl4Q0Xm3bZRQ5gK3zGXRi/24XT8L7FI= +github.com/vcaesar/imgo v0.0.0-20181209162409-13af122cf2fa/go.mod h1:D+Ywq+8bsOIg4nUk1lgHtPGxYxknhySi/HfZjG7VN/g= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793 h1:u+LnwYTOOW7Ukr/fppxEb1Nwz0AtPflrblfvUudpo+I= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/image v0.0.0-20181116024801-cd38e8056d9b/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067 h1:KYGJGHOQy8oSi1fDlSpcZF0+juKwk/hEMv5SiwHogR0= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e h1:ZytStCyV048ZqDsWHiYDdoI2Vd4msMcrDECFxS+tL9c= +golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/pkg/mousemover/mouseMover_test.go b/pkg/mousemover/mouseMover_test.go new file mode 100644 index 0000000..f0627fb --- /dev/null +++ b/pkg/mousemover/mouseMover_test.go @@ -0,0 +1,20 @@ +package mousemover + +import ( + "fmt" + "math" + "testing" + + "github.com/go-vgo/robotgo" + "github.com/stretchr/testify/assert" +) + +func TestMouseMove(t *testing.T) { + fmt.Println("starting test") + movePixel := 10 + currentX, _ := robotgo.GetMousePos() + commCh := make(chan bool, 1) + moveMouse(movePixel, commCh) + movedX, _ := robotgo.GetMousePos() + assert.Equal(t, float64(movePixel), math.Abs(float64(movedX-currentX))) +}