Merge pull request #99 from moorereason/unused
Remove unused code
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 @@
"io"
"io/ioutil"
"os"
- "path"
"path/filepath"
"runtime"
"strings"
@@ -300,7 +299,6 @@
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 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 @@
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 @@
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 @@
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 debugMemMapList(fs Fs) {
- if x, ok := fs.(*MemMapFs); ok {
- x.List()
- }
-}
+// func debugMemMapList(fs Fs) {
+// if x, ok := fs.(*MemMapFs); ok {
+// x.List()
+// }
+// }