From 529281e51b30be707f67b379aed520ec66c8900a Mon Sep 17 00:00:00 2001 From: Cameron Moore Date: Mon, 3 Oct 2016 22:03:51 -0500 Subject: [PATCH] Remove unused code --- afero_test.go | 36 ------------------------------------ cacheOnReadFs.go | 3 +-- memmap.go | 12 +++++------- 3 files changed, 6 insertions(+), 45 deletions(-) diff --git a/afero_test.go b/afero_test.go index fee91f9..526afa9 100644 --- a/afero_test.go +++ b/afero_test.go @@ -20,7 +20,6 @@ import ( "io" "io/ioutil" "os" - "path" "path/filepath" "runtime" "strings" @@ -300,7 +299,6 @@ func TestRemove(t *testing.T) { func TestTruncate(t *testing.T) { defer removeAllTestFiles(t) for _, fs := range Fss { - // f := newFile("TestTruncate", fs, t) f := tmpFile(fs) defer f.Close() @@ -381,7 +379,6 @@ func TestReadAt(t *testing.T) { func TestWriteAt(t *testing.T) { defer removeAllTestFiles(t) for _, fs := range Fss { - // f := newFile("TestWriteAt", fs, t) f := tmpFile(fs) defer f.Close() @@ -681,39 +678,6 @@ func removeAllTestFiles(t *testing.T) { testRegistry = make(map[Fs][]string) } -func newFile(testName string, fs Fs, t *testing.T) (f File) { - // Use a local file system, not NFS. - // On Unix, override $TMPDIR in case the user - // has it set to an NFS-mounted directory. - dir := "" - if runtime.GOOS != "windows" { - dir = "/tmp" - } - fs.MkdirAll(dir, 0777) - f, err := fs.Create(path.Join(dir, testName)) - if err != nil { - t.Fatalf("%v: open %s: %s", fs.Name(), testName, err) - } - return f -} - -func writeFile(t *testing.T, fs Fs, fname string, flag int, text string) string { - f, err := fs.OpenFile(fname, flag, 0666) - if err != nil { - t.Fatalf("Unable to Open file %q for writing: %v", fname, err) - } - n, err := io.WriteString(f, text) - if err != nil { - t.Fatalf("WriteString: %d, %v", n, err) - } - f.Close() - data, err := ioutil.ReadFile(fname) - if err != nil { - t.Fatalf("ReadFile: %v", err) - } - return string(data) -} - func equal(name1, name2 string) (r bool) { switch runtime.GOOS { case "windows": diff --git a/cacheOnReadFs.go b/cacheOnReadFs.go index d742425..e54a4f8 100644 --- a/cacheOnReadFs.go +++ b/cacheOnReadFs.go @@ -32,9 +32,8 @@ func NewCacheOnReadFs(base Fs, layer Fs, cacheTime time.Duration) Fs { type cacheState int const ( - cacheUnknown cacheState = iota // not present in the overlay, unknown if it exists in the base: - cacheMiss + cacheMiss cacheState = iota // present in the overlay and in base, base file is newer: cacheStale // present in the overlay - with cache time == 0 it may exist in the base, diff --git a/memmap.go b/memmap.go index 2e259b8..26a7e53 100644 --- a/memmap.go +++ b/memmap.go @@ -35,8 +35,6 @@ func NewMemMapFs() Fs { return &MemMapFs{} } -var memfsInit sync.Once - func (m *MemMapFs) getData() map[string]*mem.FileData { m.init.Do(func() { m.data = make(map[string]*mem.FileData) @@ -342,8 +340,8 @@ func (m *MemMapFs) List() { } } -func debugMemMapList(fs Fs) { - if x, ok := fs.(*MemMapFs); ok { - x.List() - } -} +// func debugMemMapList(fs Fs) { +// if x, ok := fs.(*MemMapFs); ok { +// x.List() +// } +// }