forked from mirror/afero
Remove unused code
This commit is contained in:
parent
20500e2abd
commit
529281e51b
|
@ -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":
|
||||
|
|
|
@ -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,
|
||||
|
|
12
memmap.go
12
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()
|
||||
// }
|
||||
// }
|
||||
|
|
Loading…
Reference in New Issue