diff --git a/Makefile b/Makefile deleted file mode 100644 index 83705fc..0000000 --- a/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include $(GOROOT)/src/Make.inc - -TARG=github.com/pmylund/go-cache -GOFILES=\ - cache.go\ - -include $(GOROOT)/src/Make.pkg diff --git a/README b/README index 174ddf2..6901581 100644 --- a/README +++ b/README @@ -9,7 +9,7 @@ from downtime quickly. == Installation -goinstall github.com/pmylund/go-cache +go get github.com/pmylund/go-cache == Usage diff --git a/cache_test.go b/cache_test.go index 6ad4a34..cc1b21f 100644 --- a/cache_test.go +++ b/cache_test.go @@ -2,7 +2,7 @@ package cache import ( "bytes" - "os" + "io/ioutil" "testing" "time" ) @@ -586,12 +586,20 @@ func TestFileSerialization(t *testing.T) { tc := New(0, 0) tc.Add("a", "a", 0) tc.Add("b", "b", 0) - fname := "_test/cache.dat" + f, err := ioutil.TempFile("", "go-cache-cache.dat") + if err != nil { + t.Fatal("Couldn't create cache file:", err) + } + fname := f.Name() + f.Close() tc.SaveFile(fname) oc := New(0, 0) oc.Add("a", "aa", 0) // this should not be overwritten - oc.LoadFile(fname) + err = oc.LoadFile(fname) + if err != nil { + t.Error(err) + } a, found := oc.Get("a") if !found { t.Error("a was not found") @@ -611,7 +619,6 @@ func TestFileSerialization(t *testing.T) { if b.(string) != "b" { t.Error("b is not b") } - os.Remove(fname) } func TestSerializeUnserializable(t *testing.T) {