cmd/torrentfs/main.go | 2 +- tracker/udp_test.go | 4 +--- util/dirwatch/dirwatch_test.go | 6 +++--- diff --git a/cmd/torrentfs/main.go b/cmd/torrentfs/main.go index 1d12d6a75c49c6f18d08ee0a3da8c2d2bd8a21ff..ed3d94bf9599b8cf548941d3e3950803b30ad4cd 100644 --- a/cmd/torrentfs/main.go +++ b/cmd/torrentfs/main.go @@ -48,7 +48,7 @@ } ) func exitSignalHandlers(fs *torrentfs.TorrentFS) { - c := make(chan os.Signal) + c := make(chan os.Signal, 1) signal.Notify(c, syscall.SIGINT, syscall.SIGTERM) for { <-c diff --git a/tracker/udp_test.go b/tracker/udp_test.go index 61ff8c5848287c732aac193b392b51c1cf37fa11..3330cba3807078549d5f3f2a012e8dfea36a4323 100644 --- a/tracker/udp_test.go +++ b/tracker/udp_test.go @@ -48,10 +48,8 @@ // Failure to write an entire packet to UDP is expected to given an error. func TestLongWriteUDP(t *testing.T) { t.Parallel() l, err := net.ListenUDP("udp4", nil) + require.NoError(t, err) defer l.Close() - if err != nil { - t.Fatal(err) - } c, err := net.DialUDP("udp", nil, l.LocalAddr().(*net.UDPAddr)) if err != nil { t.Fatal(err) diff --git a/util/dirwatch/dirwatch_test.go b/util/dirwatch/dirwatch_test.go index 40d68ff7730b990c64d0c0bee5e2aa87bf076614..220f58b5dc429d8afde6ea7ccd9b6f3aa0a741a5 100644 --- a/util/dirwatch/dirwatch_test.go +++ b/util/dirwatch/dirwatch_test.go @@ -4,6 +4,8 @@ import ( "io/ioutil" "os" "testing" + + "github.com/stretchr/testify/require" ) func TestDirwatch(t *testing.T) { @@ -14,8 +16,6 @@ } defer os.RemoveAll(tempDirName) t.Logf("tempdir: %q", tempDirName) dw, err := New(tempDirName) + require.NoError(t, err) defer dw.Close() - if err != nil { - t.Fatal(err) - } }