From b95b9110a4d890cf9b980d4d34cf4efa4db0fe53 Mon Sep 17 00:00:00 2001 From: Patrick Mylund Nielsen Date: Sun, 12 Feb 2012 00:15:25 +0100 Subject: [PATCH] Get ready for Go1 --- Makefile | 7 ------- README | 2 +- cache_test.go | 15 +++++++++++---- 3 files changed, 12 insertions(+), 12 deletions(-) delete mode 100644 Makefile 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) {