Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: fix ci lint error #31

Merged
merged 1 commit into from
Feb 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions gowatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func Autobuild(files []string) {
}
}

// Kill
// Kill kill main process and all its children
func Kill() {
defer func() {
if e := recover(); e != nil {
Expand Down Expand Up @@ -194,7 +194,7 @@ func killAllProcesses(pid int) (err error) {
log.Debugf("pids: %+v", pids)

for _, subPid := range pids {
killProcess(subPid)
_ = killProcess(subPid)
}

waitForProcess(pid, hasAllKilled)
Expand Down Expand Up @@ -225,7 +225,7 @@ func killProcess(pid int) (err error) {
// retry
time.AfterFunc(2*time.Second, func() {
log.Debugf("retry killing process pid: %d", pid)
killProcess(pid)
_ = killProcess(pid)
})
return
}
Expand Down Expand Up @@ -257,7 +257,7 @@ func psTree(rootPid int) (res []int, err error) {
}
}

for pid, _ := range pidOfInterest {
for pid := range pidOfInterest {
if pid != rootPid {
res = append(res, pid)
}
Expand All @@ -266,7 +266,7 @@ func psTree(rootPid int) (res []int, err error) {
return
}

func waitForProcess(pid int, hasAllKilled chan bool) (err error) {
func waitForProcess(pid int, hasAllKilled chan bool) {
pids, _ := psTree(pid)
if len(pids) == 0 {
hasAllKilled <- true
Expand All @@ -277,7 +277,6 @@ func waitForProcess(pid int, hasAllKilled chan bool) (err error) {
time.AfterFunc(time.Second, func() {
waitForProcess(pid, hasAllKilled)
})
return
}

// Restart restart app
Expand Down