diff --git a/config/config_test.go b/config/config_test.go index 86eb38c..e98a37a 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -10,10 +10,14 @@ func TestNoConfig(t *testing.T) { c := ConfigService{} c.ConfigFilename = emptyTempFile() - os.Remove(c.ConfigFilename) + err := os.Remove(c.ConfigFilename) + if err != nil { + t.Fatalf("could not remove file: %v", err) + } + defer os.Remove(c.ConfigFilename) // because we are about to create it - err := c.LoadOrInit() + err = c.LoadOrInit() if err != nil { t.Errorf("unexpected failure from load: %s", err) } @@ -84,6 +88,7 @@ func emptyTempFile() string { if err != nil { panic(err) } + f.Close() return f.Name() } diff --git a/dau_test.go b/dau_test.go index 0932ef6..10a2bd4 100644 --- a/dau_test.go +++ b/dau_test.go @@ -80,7 +80,11 @@ func TestCheckPath(t *testing.T) { if !w.checkPath() { t.Error("checkPath failed?") } - os.RemoveAll(dir) + + err := os.RemoveAll(dir) + if err != nil { + t.Fatalf("could not remove test dir: %v", err) + } if w.checkPath() { t.Error("checkPath succeeded when shouldn't?") } @@ -91,9 +95,11 @@ func createFileTree() string { if err != nil { log.Fatal(err) } - os.Create(fmt.Sprintf("%s%c%s", dir, os.PathSeparator, "a.gif")) - os.Create(fmt.Sprintf("%s%c%s", dir, os.PathSeparator, "a.jpg")) - os.Create(fmt.Sprintf("%s%c%s", dir, os.PathSeparator, "a.png")) - + f1, _ := os.Create(fmt.Sprintf("%s%c%s", dir, os.PathSeparator, "a.gif")) + f2, _ := os.Create(fmt.Sprintf("%s%c%s", dir, os.PathSeparator, "a.jpg")) + f3, _ := os.Create(fmt.Sprintf("%s%c%s", dir, os.PathSeparator, "a.png")) + f1.Close() + f2.Close() + f3.Close() return dir }