linter: couple fixes

This commit is contained in:
Zach Ramsay
2017-10-03 17:23:14 -04:00
parent 2681f32bdd
commit cf49ba876f
5 changed files with 18 additions and 27 deletions
+1 -2
View File
@@ -8,7 +8,6 @@ import (
"os"
"os/signal"
"strings"
"syscall"
)
var (
@@ -18,7 +17,7 @@ var (
func TrapSignal(cb func()) {
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt)
signal.Notify(c, syscall.SIGTERM)
signal.Notify(c, os.Kill) // nolint: megacheck
go func() {
for sig := range c {
fmt.Printf("captured %v, exiting...\n", sig)
+7 -9
View File
@@ -140,18 +140,16 @@ func (bs *BaseService) OnStop() {}
// Implements Service
func (bs *BaseService) Reset() (bool, error) {
if atomic.CompareAndSwapUint32(&bs.stopped, 1, 0) {
// whether or not we've started, we can reset
atomic.CompareAndSwapUint32(&bs.started, 1, 0)
bs.Quit = make(chan struct{})
return true, bs.impl.OnReset()
} else {
if stopped := atomic.CompareAndSwapUint32(&bs.stopped, 1, 0); !stopped {
bs.Logger.Debug(Fmt("Can't reset %v. Not stopped", bs.name), "impl", bs.impl)
return false, nil
}
// never happens
return false, nil // nolint: vet
// whether or not we've started, we can reset
atomic.CompareAndSwapUint32(&bs.started, 1, 0)
bs.Quit = make(chan struct{})
return true, bs.impl.OnReset()
}
// Implements Service