Merge pull request #99 from moorereason/unused

Remove unused code
This commit is contained in:
Martin Bertschler 2016-12-08 19:19:22 +01:00 committed by GitHub
commit 8a1f1350d8
3 changed files with 6 additions and 45 deletions

View File

@ -20,7 +20,6 @@ import (
"io" "io"
"io/ioutil" "io/ioutil"
"os" "os"
"path"
"path/filepath" "path/filepath"
"runtime" "runtime"
"strings" "strings"
@ -300,7 +299,6 @@ func TestRemove(t *testing.T) {
func TestTruncate(t *testing.T) { func TestTruncate(t *testing.T) {
defer removeAllTestFiles(t) defer removeAllTestFiles(t)
for _, fs := range Fss { for _, fs := range Fss {
// f := newFile("TestTruncate", fs, t)
f := tmpFile(fs) f := tmpFile(fs)
defer f.Close() defer f.Close()
@ -381,7 +379,6 @@ func TestReadAt(t *testing.T) {
func TestWriteAt(t *testing.T) { func TestWriteAt(t *testing.T) {
defer removeAllTestFiles(t) defer removeAllTestFiles(t)
for _, fs := range Fss { for _, fs := range Fss {
// f := newFile("TestWriteAt", fs, t)
f := tmpFile(fs) f := tmpFile(fs)
defer f.Close() defer f.Close()
@ -681,39 +678,6 @@ func removeAllTestFiles(t *testing.T) {
testRegistry = make(map[Fs][]string) 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) { func equal(name1, name2 string) (r bool) {
switch runtime.GOOS { switch runtime.GOOS {
case "windows": case "windows":

View File

@ -32,9 +32,8 @@ func NewCacheOnReadFs(base Fs, layer Fs, cacheTime time.Duration) Fs {
type cacheState int type cacheState int
const ( const (
cacheUnknown cacheState = iota
// not present in the overlay, unknown if it exists in the base: // 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: // present in the overlay and in base, base file is newer:
cacheStale cacheStale
// present in the overlay - with cache time == 0 it may exist in the base, // present in the overlay - with cache time == 0 it may exist in the base,

View File

@ -35,8 +35,6 @@ func NewMemMapFs() Fs {
return &MemMapFs{} return &MemMapFs{}
} }
var memfsInit sync.Once
func (m *MemMapFs) getData() map[string]*mem.FileData { func (m *MemMapFs) getData() map[string]*mem.FileData {
m.init.Do(func() { m.init.Do(func() {
m.data = make(map[string]*mem.FileData) m.data = make(map[string]*mem.FileData)
@ -342,8 +340,8 @@ func (m *MemMapFs) List() {
} }
} }
func debugMemMapList(fs Fs) { // func debugMemMapList(fs Fs) {
if x, ok := fs.(*MemMapFs); ok { // if x, ok := fs.(*MemMapFs); ok {
x.List() // x.List()
} // }
} // }