Browse Source

metalinter fixes from review

pull/1842/head
Ethan Buchman 7 years ago
parent
commit
c8805fd7de
3 changed files with 6 additions and 5 deletions
  1. +3
    -2
      autofile/autofile_test.go
  2. +2
    -2
      common/os.go
  3. +1
    -1
      common/service.go

+ 3
- 2
autofile/autofile_test.go 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)
} }


+ 2
- 2
common/os.go 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.Kill) // nolint: megacheck
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
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)


+ 1
- 1
common/service.go 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
} }


Loading…
Cancel
Save