lint issue

This commit is contained in:
Prashant Gupta 2019-03-27 16:10:07 -07:00
parent 5a1d59fcad
commit b242ba4a8f

View File

@ -9,9 +9,10 @@ import (
"github.com/prashantgupta24/activity-tracker/pkg/tracker" "github.com/prashantgupta24/activity-tracker/pkg/tracker"
) )
var instance *mouseMover var instance *MouseMover
type mouseMover struct { //MouseMover is the main struct for the app
type MouseMover struct {
quit chan struct{} quit chan struct{}
isRunning bool isRunning bool
} }
@ -20,7 +21,8 @@ const (
timeout = 100 //ms timeout = 100 //ms
) )
func (m *mouseMover) Start() { //Start the main app
func (m *MouseMover) Start() {
m.quit = make(chan struct{}) m.quit = make(chan struct{})
frequency := 5 //value always in seconds frequency := 5 //value always in seconds
@ -31,7 +33,7 @@ func (m *mouseMover) Start() {
heartbeatCh := activityTracker.Start() heartbeatCh := activityTracker.Start()
go func(m *mouseMover) { go func(m *MouseMover) {
m.isRunning = true m.isRunning = true
movePixel := 10 movePixel := 10
for { for {
@ -70,7 +72,8 @@ func moveMouse(movePixel int, commCh chan bool) {
commCh <- true commCh <- true
} }
func (m *mouseMover) Quit() { //Quit the app
func (m *MouseMover) Quit() {
//making it idempotent //making it idempotent
if m != nil && m.isRunning { if m != nil && m.isRunning {
m.quit <- struct{}{} m.quit <- struct{}{}
@ -78,9 +81,9 @@ func (m *mouseMover) Quit() {
} }
//GetInstance gets the singleton instance for mouse mover app //GetInstance gets the singleton instance for mouse mover app
func GetInstance() *mouseMover { func GetInstance() *MouseMover {
if instance == nil { if instance == nil {
instance = &mouseMover{} instance = &MouseMover{}
} }
return instance return instance
} }