metalinter fixes from review

This commit is contained in:
Ethan Buchman
2017-10-04 00:13:58 -04:00
parent cf49ba876f
commit c8805fd7de
3 changed files with 6 additions and 5 deletions

View File

@ -18,7 +18,7 @@ func TestSIGHUP(t *testing.T) {
t.Fatalf("Error creating tempfile: %v", err) t.Fatalf("Error creating tempfile: %v", err)
} }
// Here is the actual AutoFile // Here is the actual AutoFile
af, err := cmn.OpenAutoFile(name) af, err := OpenAutoFile(name)
if err != nil { if err != nil {
t.Fatalf("Error creating autofile: %v", err) t.Fatalf("Error creating autofile: %v", err)
} }
@ -34,7 +34,8 @@ func TestSIGHUP(t *testing.T) {
} }
// Move the file over // 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) t.Fatalf("Error moving autofile: %v", err)
} }

View File

@ -8,6 +8,7 @@ import (
"os" "os"
"os/signal" "os/signal"
"strings" "strings"
"syscall"
) )
var ( var (
@ -16,8 +17,7 @@ var (
func TrapSignal(cb func()) { func TrapSignal(cb func()) {
c := make(chan os.Signal, 1) c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt) signal.Notify(c, os.Interrupt, syscall.SIGTERM)
signal.Notify(c, os.Kill) // nolint: megacheck
go func() { go func() {
for sig := range c { for sig := range c {
fmt.Printf("captured %v, exiting...\n", sig) fmt.Printf("captured %v, exiting...\n", sig)

View File

@ -140,7 +140,7 @@ func (bs *BaseService) OnStop() {}
// Implements Service // Implements Service
func (bs *BaseService) Reset() (bool, error) { 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) bs.Logger.Debug(Fmt("Can't reset %v. Not stopped", bs.name), "impl", bs.impl)
return false, nil return false, nil
} }