Commit b3ea7e6b authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Run gofmt.

parent 4cc77e52
......@@ -65,7 +65,7 @@ func NewSwitchFileSystem(fsMap []SwitchedFileSystem) *SwitchFileSystem {
// numbers of switched filesystems.
func (me *SwitchFileSystem) findFileSystem(path string) (string, *SwitchedFileSystem) {
for _, swFs := range me.fileSystems {
if swFs.Prefix == "" || swFs.Prefix == path || strings.HasPrefix(path, swFs.Prefix + string(filepath.Separator)) {
if swFs.Prefix == "" || swFs.Prefix == path || strings.HasPrefix(path, swFs.Prefix+string(filepath.Separator)) {
if swFs.StripPrefix {
path = strings.TrimLeft(path[len(swFs.Prefix):], string(filepath.Separator))
}
......@@ -271,4 +271,3 @@ func (me *SwitchFileSystem) Flush(name string) Status {
}
return fs.FileSystem.Flush(name)
}
......@@ -7,12 +7,12 @@ import (
func TestSwitchFsSlash(t *testing.T) {
fsMap := []SwitchedFileSystem{
SwitchedFileSystem{Prefix: ""},
SwitchedFileSystem{Prefix:"/home"},
SwitchedFileSystem{Prefix:"usr/"},
SwitchedFileSystem{Prefix: "/home"},
SwitchedFileSystem{Prefix: "usr/"},
}
sfs := NewSwitchFileSystem(fsMap)
for path, expectPrefix := range map[string]string {
for path, expectPrefix := range map[string]string{
"home/foo/bar": "home",
"usr/local": "usr",
} {
......@@ -26,14 +26,14 @@ func TestSwitchFsSlash(t *testing.T) {
func TestSwitchFs(t *testing.T) {
fsMap := []SwitchedFileSystem{
SwitchedFileSystem{Prefix: ""},
SwitchedFileSystem{Prefix:"home/foo"},
SwitchedFileSystem{Prefix:"home"},
SwitchedFileSystem{Prefix:"usr"},
SwitchedFileSystem{Prefix: "home/foo"},
SwitchedFileSystem{Prefix: "home"},
SwitchedFileSystem{Prefix: "usr"},
}
sfs := NewSwitchFileSystem(fsMap)
for path, expectPrefix := range map[string]string {
for path, expectPrefix := range map[string]string{
"xyz": "",
"home/foo/bar": "home/foo",
"home/fooz/bar": "home",
......@@ -53,14 +53,14 @@ func TestSwitchFs(t *testing.T) {
func TestSwitchFsStrip(t *testing.T) {
fsMap := []SwitchedFileSystem{
SwitchedFileSystem{Prefix: ""},
SwitchedFileSystem{Prefix:"dev", StripPrefix: true},
SwitchedFileSystem{Prefix:"home", StripPrefix: false},
SwitchedFileSystem{Prefix: "dev", StripPrefix: true},
SwitchedFileSystem{Prefix: "home", StripPrefix: false},
}
sfs := NewSwitchFileSystem(fsMap)
// Don't check for inputs ending in '/' since Go-FUSE never
// generates them.
for path, expectPath := range map[string]string {
for path, expectPath := range map[string]string{
"xyz": "xyz",
"home/foo/bar": "home/foo/bar",
"home": "home",
......
......@@ -76,7 +76,7 @@ func (me *AutoUnionFs) addAutomaticFs(roots []string) {
}
}
func (me *AutoUnionFs) createFs(name string, roots []string) (fuse.Status) {
func (me *AutoUnionFs) createFs(name string, roots []string) fuse.Status {
me.lock.Lock()
defer me.lock.Unlock()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment