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 { ...@@ -65,7 +65,7 @@ func NewSwitchFileSystem(fsMap []SwitchedFileSystem) *SwitchFileSystem {
// numbers of switched filesystems. // numbers of switched filesystems.
func (me *SwitchFileSystem) findFileSystem(path string) (string, *SwitchedFileSystem) { func (me *SwitchFileSystem) findFileSystem(path string) (string, *SwitchedFileSystem) {
for _, swFs := range me.fileSystems { 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 { if swFs.StripPrefix {
path = strings.TrimLeft(path[len(swFs.Prefix):], string(filepath.Separator)) path = strings.TrimLeft(path[len(swFs.Prefix):], string(filepath.Separator))
} }
...@@ -271,4 +271,3 @@ func (me *SwitchFileSystem) Flush(name string) Status { ...@@ -271,4 +271,3 @@ func (me *SwitchFileSystem) Flush(name string) Status {
} }
return fs.FileSystem.Flush(name) return fs.FileSystem.Flush(name)
} }
...@@ -7,12 +7,12 @@ import ( ...@@ -7,12 +7,12 @@ import (
func TestSwitchFsSlash(t *testing.T) { func TestSwitchFsSlash(t *testing.T) {
fsMap := []SwitchedFileSystem{ fsMap := []SwitchedFileSystem{
SwitchedFileSystem{Prefix: ""}, SwitchedFileSystem{Prefix: ""},
SwitchedFileSystem{Prefix:"/home"}, SwitchedFileSystem{Prefix: "/home"},
SwitchedFileSystem{Prefix:"usr/"}, SwitchedFileSystem{Prefix: "usr/"},
} }
sfs := NewSwitchFileSystem(fsMap) sfs := NewSwitchFileSystem(fsMap)
for path, expectPrefix := range map[string]string { for path, expectPrefix := range map[string]string{
"home/foo/bar": "home", "home/foo/bar": "home",
"usr/local": "usr", "usr/local": "usr",
} { } {
...@@ -26,14 +26,14 @@ func TestSwitchFsSlash(t *testing.T) { ...@@ -26,14 +26,14 @@ func TestSwitchFsSlash(t *testing.T) {
func TestSwitchFs(t *testing.T) { func TestSwitchFs(t *testing.T) {
fsMap := []SwitchedFileSystem{ fsMap := []SwitchedFileSystem{
SwitchedFileSystem{Prefix: ""}, SwitchedFileSystem{Prefix: ""},
SwitchedFileSystem{Prefix:"home/foo"}, SwitchedFileSystem{Prefix: "home/foo"},
SwitchedFileSystem{Prefix:"home"}, SwitchedFileSystem{Prefix: "home"},
SwitchedFileSystem{Prefix:"usr"}, SwitchedFileSystem{Prefix: "usr"},
} }
sfs := NewSwitchFileSystem(fsMap) sfs := NewSwitchFileSystem(fsMap)
for path, expectPrefix := range map[string]string { for path, expectPrefix := range map[string]string{
"xyz": "", "xyz": "",
"home/foo/bar": "home/foo", "home/foo/bar": "home/foo",
"home/fooz/bar": "home", "home/fooz/bar": "home",
...@@ -53,14 +53,14 @@ func TestSwitchFs(t *testing.T) { ...@@ -53,14 +53,14 @@ func TestSwitchFs(t *testing.T) {
func TestSwitchFsStrip(t *testing.T) { func TestSwitchFsStrip(t *testing.T) {
fsMap := []SwitchedFileSystem{ fsMap := []SwitchedFileSystem{
SwitchedFileSystem{Prefix: ""}, SwitchedFileSystem{Prefix: ""},
SwitchedFileSystem{Prefix:"dev", StripPrefix: true}, SwitchedFileSystem{Prefix: "dev", StripPrefix: true},
SwitchedFileSystem{Prefix:"home", StripPrefix: false}, SwitchedFileSystem{Prefix: "home", StripPrefix: false},
} }
sfs := NewSwitchFileSystem(fsMap) sfs := NewSwitchFileSystem(fsMap)
// Don't check for inputs ending in '/' since Go-FUSE never // Don't check for inputs ending in '/' since Go-FUSE never
// generates them. // generates them.
for path, expectPath := range map[string]string { for path, expectPath := range map[string]string{
"xyz": "xyz", "xyz": "xyz",
"home/foo/bar": "home/foo/bar", "home/foo/bar": "home/foo/bar",
"home": "home", "home": "home",
......
...@@ -76,7 +76,7 @@ func (me *AutoUnionFs) addAutomaticFs(roots []string) { ...@@ -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() me.lock.Lock()
defer me.lock.Unlock() 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