diff --git a/autofile/autofile_test.go b/autofile/autofile_test.go index 05152219c..8f453dd07 100644 --- a/autofile/autofile_test.go +++ b/autofile/autofile_test.go @@ -18,7 +18,7 @@ func TestSIGHUP(t *testing.T) { t.Fatalf("Error creating tempfile: %v", err) } // Here is the actual AutoFile - af, err := cmn.OpenAutoFile(name) + af, err := OpenAutoFile(name) if err != nil { t.Fatalf("Error creating autofile: %v", err) } @@ -34,7 +34,8 @@ func TestSIGHUP(t *testing.T) { } // Move the file over - if err := os.Rename(name, name+"_old"); err != nil { + err = os.Rename(name, name+"_old") + if err != nil { t.Fatalf("Error moving autofile: %v", err) } diff --git a/common/os.go b/common/os.go index 19aa479f9..625d6ae16 100644 --- a/common/os.go +++ b/common/os.go @@ -8,6 +8,7 @@ import ( "os" "os/signal" "strings" + "syscall" ) var ( @@ -16,8 +17,7 @@ var ( func TrapSignal(cb func()) { c := make(chan os.Signal, 1) - signal.Notify(c, os.Interrupt) - signal.Notify(c, os.Kill) // nolint: megacheck + signal.Notify(c, os.Interrupt, syscall.SIGTERM) go func() { for sig := range c { fmt.Printf("captured %v, exiting...\n", sig) diff --git a/common/service.go b/common/service.go index 2d86baafe..8d4de30a8 100644 --- a/common/service.go +++ b/common/service.go @@ -140,7 +140,7 @@ func (bs *BaseService) OnStop() {} // Implements Service func (bs *BaseService) Reset() (bool, error) { - if stopped := atomic.CompareAndSwapUint32(&bs.stopped, 1, 0); !stopped { + if !atomic.CompareAndSwapUint32(&bs.stopped, 1, 0) { bs.Logger.Debug(Fmt("Can't reset %v. Not stopped", bs.name), "impl", bs.impl) return false, nil }