diff options
author | Bjørn Erik Pedersen <[email protected]> | 2020-12-02 13:23:25 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2020-12-03 13:12:58 +0100 |
commit | d90e37e0c6e812f9913bf256c9c81aa05b7a08aa (patch) | |
tree | 7b1b14464eefec1188ca2eed53c64e4823453cc9 /hugofs | |
parent | 32471b57bde51c55a15dbf1db75d6e5f7232c347 (diff) | |
download | hugo-d90e37e0c6e812f9913bf256c9c81aa05b7a08aa.tar.gz hugo-d90e37e0c6e812f9913bf256c9c81aa05b7a08aa.zip |
all: Format code with gofumpt
See https://github.com/mvdan/gofumpt
Diffstat (limited to 'hugofs')
-rw-r--r-- | hugofs/decorators.go | 6 | ||||
-rw-r--r-- | hugofs/fileinfo.go | 5 | ||||
-rw-r--r-- | hugofs/files/classifier.go | 6 | ||||
-rw-r--r-- | hugofs/files/classifier_test.go | 2 | ||||
-rw-r--r-- | hugofs/filter_fs.go | 10 | ||||
-rw-r--r-- | hugofs/filter_fs_test.go | 2 | ||||
-rw-r--r-- | hugofs/fs.go | 6 | ||||
-rw-r--r-- | hugofs/fs_test.go | 2 | ||||
-rw-r--r-- | hugofs/glob.go | 1 | ||||
-rw-r--r-- | hugofs/glob/glob.go | 2 | ||||
-rw-r--r-- | hugofs/glob/glob_test.go | 4 | ||||
-rw-r--r-- | hugofs/glob_test.go | 1 | ||||
-rw-r--r-- | hugofs/hashing_fs.go | 4 | ||||
-rw-r--r-- | hugofs/hashing_fs_test.go | 1 | ||||
-rw-r--r-- | hugofs/nosymlink_fs.go | 5 | ||||
-rw-r--r-- | hugofs/nosymlink_test.go | 1 | ||||
-rw-r--r-- | hugofs/rootmapping_fs.go | 14 | ||||
-rw-r--r-- | hugofs/rootmapping_fs_test.go | 22 | ||||
-rw-r--r-- | hugofs/slice_fs.go | 5 | ||||
-rw-r--r-- | hugofs/walk.go | 4 | ||||
-rw-r--r-- | hugofs/walk_test.go | 11 |
21 files changed, 24 insertions, 90 deletions
diff --git a/hugofs/decorators.go b/hugofs/decorators.go index 6247f6183..62d234944 100644 --- a/hugofs/decorators.go +++ b/hugofs/decorators.go @@ -38,11 +38,9 @@ func decorateDirs(fs afero.Fs, meta FileMeta) afero.Fs { ffs.decorate = decorator return ffs - } func decoratePath(fs afero.Fs, createPath func(name string) string) afero.Fs { - ffs := &baseFileDecoratorFs{Fs: fs} decorator := func(fi os.FileInfo, name string) (os.FileInfo, error) { @@ -54,7 +52,6 @@ func decoratePath(fs afero.Fs, createPath func(name string) string) afero.Fs { ffs.decorate = decorator return ffs - } // DecorateBasePathFs adds Path info to files and directories in the @@ -81,7 +78,6 @@ func DecorateBasePathFs(base *afero.BasePathFs) afero.Fs { // NewBaseFileDecorator decorates the given Fs to provide the real filename // and an Opener func. func NewBaseFileDecorator(fs afero.Fs, callbacks ...func(fi FileMetaInfo)) afero.Fs { - ffs := &baseFileDecoratorFs{Fs: fs} decorator := func(fi os.FileInfo, filename string) (os.FileInfo, error) { @@ -128,7 +124,6 @@ func NewBaseFileDecorator(fs afero.Fs, callbacks ...func(fi FileMetaInfo)) afero } return fim, nil - } ffs.decorate = decorator @@ -161,7 +156,6 @@ func (fs *baseFileDecoratorFs) Stat(name string) (os.FileInfo, error) { } return fs.decorate(fi, name) - } func (fs *baseFileDecoratorFs) LstatIfPossible(name string) (os.FileInfo, bool, error) { diff --git a/hugofs/fileinfo.go b/hugofs/fileinfo.go index 5bfb1ff32..d68321282 100644 --- a/hugofs/fileinfo.go +++ b/hugofs/fileinfo.go @@ -86,6 +86,7 @@ func (f FileMeta) OriginalFilename() string { func (f FileMeta) SkipDir() bool { return f.GetBool(metaKeySkipDir) } + func (f FileMeta) TranslationBaseName() string { return f.stringV(metaKeyTranslationBaseName) } @@ -236,7 +237,6 @@ func (fi *fileInfoMeta) Meta() FileMeta { } func NewFileMetaInfo(fi os.FileInfo, m FileMeta) FileMetaInfo { - if fim, ok := fi.(FileMetaInfo); ok { mergeFileMeta(fim.Meta(), m) } @@ -312,7 +312,6 @@ func decorateFileInfo( fi os.FileInfo, fs afero.Fs, opener func() (afero.File, error), filename, filepath string, inMeta FileMeta) FileMetaInfo { - var meta FileMeta var fim FileMetaInfo @@ -334,7 +333,6 @@ func decorateFileInfo( mergeFileMeta(inMeta, meta) return fim - } func isSymlink(fi os.FileInfo) bool { @@ -379,6 +377,5 @@ func sortFileInfos(fis []os.FileInfo) { sort.Slice(fis, func(i, j int) bool { fimi, fimj := fis[i].(FileMetaInfo), fis[j].(FileMetaInfo) return fimi.Meta().Filename() < fimj.Meta().Filename() - }) } diff --git a/hugofs/files/classifier.go b/hugofs/files/classifier.go index 35e416c8f..f0e0911ab 100644 --- a/hugofs/files/classifier.go +++ b/hugofs/files/classifier.go @@ -42,12 +42,14 @@ var ( "rest", "rst", "mmark", "org", - "pandoc", "pdc"} + "pandoc", "pdc", + } contentFileExtensionsSet map[string]bool htmlFileExtensions = []string{ - "html", "htm"} + "html", "htm", + } htmlFileExtensionsSet map[string]bool ) diff --git a/hugofs/files/classifier_test.go b/hugofs/files/classifier_test.go index 0cd7e4177..84036b870 100644 --- a/hugofs/files/classifier_test.go +++ b/hugofs/files/classifier_test.go @@ -39,7 +39,6 @@ func TestIsHTMLContent(t *testing.T) { c.Assert(isHTMLContent(strings.NewReader(" <!--")), qt.Equals, true) c.Assert(isHTMLContent(strings.NewReader(" ---<")), qt.Equals, false) c.Assert(isHTMLContent(strings.NewReader(" foo <")), qt.Equals, false) - } func TestComponentFolders(t *testing.T) { @@ -57,5 +56,4 @@ func TestComponentFolders(t *testing.T) { c.Assert(IsComponentFolder("content"), qt.Equals, true) c.Assert(IsComponentFolder("foo"), qt.Equals, false) c.Assert(IsComponentFolder(""), qt.Equals, false) - } diff --git a/hugofs/filter_fs.go b/hugofs/filter_fs.go index 15373c2e5..8b0afd38d 100644 --- a/hugofs/filter_fs.go +++ b/hugofs/filter_fs.go @@ -35,9 +35,7 @@ var ( ) func NewLanguageFs(langs map[string]int, fs afero.Fs) (afero.Fs, error) { - applyMeta := func(fs *FilterFs, name string, fis []os.FileInfo) { - for i, fi := range fis { if fi.IsDir() { filename := filepath.Join(name, fi.Name()) @@ -104,11 +102,9 @@ func NewLanguageFs(langs map[string]int, fs afero.Fs) (afero.Fs, error) { applyPerSource: applyMeta, applyAll: all, }, nil - } func NewFilterFs(fs afero.Fs) (afero.Fs, error) { - applyMeta := func(fs *FilterFs, name string, fis []os.FileInfo) { for i, fi := range fis { if fi.IsDir() { @@ -123,7 +119,6 @@ func NewFilterFs(fs afero.Fs) (afero.Fs, error) { } return ffs, nil - } // FilterFs is an ordered composite filesystem. @@ -144,7 +139,6 @@ func (fs *FilterFs) Chtimes(n string, a, m time.Time) error { func (fs *FilterFs) LstatIfPossible(name string) (os.FileInfo, bool, error) { fi, b, err := lstatIfPossible(fs.fs, name) - if err != nil { return nil, false, err } @@ -157,7 +151,6 @@ func (fs *FilterFs) LstatIfPossible(name string) (os.FileInfo, bool, error) { fs.applyFilters(parent, -1, fi) return fi, b, nil - } func (fs *FilterFs) Mkdir(n string, p os.FileMode) error { @@ -182,7 +175,6 @@ func (fs *FilterFs) Open(name string) (afero.File, error) { File: f, ffs: fs, }, nil - } func (fs *FilterFs) OpenFile(name string, flag int, perm os.FileMode) (afero.File, error) { @@ -255,7 +247,6 @@ func (fs *FilterFs) applyFilters(name string, count int, fis ...os.FileInfo) ([] } return fis, nil - } type filterDir struct { @@ -313,7 +304,6 @@ func langInfoFrom(languages map[string]int, name string) (string, string, string } return lang, translationBaseName, translationBaseNameWithExt - } func printFs(fs afero.Fs, path string, w io.Writer) { diff --git a/hugofs/filter_fs_test.go b/hugofs/filter_fs_test.go index e3bf4c3b9..524d957d6 100644 --- a/hugofs/filter_fs_test.go +++ b/hugofs/filter_fs_test.go @@ -21,7 +21,6 @@ import ( ) func TestLangInfoFrom(t *testing.T) { - langs := map[string]int{ "sv": 10, "en": 20, @@ -44,5 +43,4 @@ func TestLangInfoFrom(t *testing.T) { v1, v2, v3 := langInfoFrom(langs, test.input) c.Assert([]string{v1, v2, v3}, qt.DeepEquals, test.expected) } - } diff --git a/hugofs/fs.go b/hugofs/fs.go index 75beda970..2c57fe8b5 100644 --- a/hugofs/fs.go +++ b/hugofs/fs.go @@ -23,10 +23,8 @@ import ( "github.com/spf13/afero" ) -var ( - // Os points to the (real) Os filesystem. - Os = &afero.OsFs{} -) +// Os points to the (real) Os filesystem. +var Os = &afero.OsFs{} // Fs abstracts the file system to separate source and destination file systems // and allows both to be mocked for testing. diff --git a/hugofs/fs_test.go b/hugofs/fs_test.go index 47a9482f5..a343bbd1f 100644 --- a/hugofs/fs_test.go +++ b/hugofs/fs_test.go @@ -31,7 +31,6 @@ func TestNewDefault(t *testing.T) { c.Assert(f.Source, hqt.IsSameType, new(afero.OsFs)) c.Assert(f.Os, qt.Not(qt.IsNil)) c.Assert(f.WorkingDir, qt.IsNil) - } func TestNewMem(t *testing.T) { @@ -57,5 +56,4 @@ func TestWorkingDir(t *testing.T) { c.Assert(f.WorkingDir, qt.Not(qt.IsNil)) c.Assert(f.WorkingDir, hqt.IsSameType, new(afero.BasePathFs)) - } diff --git a/hugofs/glob.go b/hugofs/glob.go index e4115ea7c..147b6b9f1 100644 --- a/hugofs/glob.go +++ b/hugofs/glob.go @@ -81,5 +81,4 @@ func Glob(fs afero.Fs, pattern string, handle func(fi FileMetaInfo) (bool, error } return nil - } diff --git a/hugofs/glob/glob.go b/hugofs/glob/glob.go index 88485e1f0..5d2d3d5e5 100644 --- a/hugofs/glob/glob.go +++ b/hugofs/glob/glob.go @@ -53,7 +53,6 @@ func GetGlob(pattern string) (glob.Glob, error) { globMu.Unlock() return eg.glob, eg.err - } func NormalizePath(p string) string { @@ -98,5 +97,4 @@ func HasGlobChar(s string) bool { } } return false - } diff --git a/hugofs/glob/glob_test.go b/hugofs/glob/glob_test.go index 5a6ef5b7e..cd64ba112 100644 --- a/hugofs/glob/glob_test.go +++ b/hugofs/glob/glob_test.go @@ -32,7 +32,6 @@ func TestResolveRootDir(t *testing.T) { {"dat?a/foo.json", ""}, {"a/b[a-c]/foo.json", "a"}, } { - c.Assert(ResolveRootDir(test.input), qt.Equals, test.expected) } } @@ -46,7 +45,6 @@ func TestFilterGlobParts(t *testing.T) { }{ {[]string{"a", "*", "c"}, []string{"a", "c"}}, } { - c.Assert(FilterGlobParts(test.input), qt.DeepEquals, test.expected) } } @@ -63,7 +61,6 @@ func TestNormalizePath(t *testing.T) { {filepath.FromSlash("./FOO.json"), "foo.json"}, {"//", ""}, } { - c.Assert(NormalizePath(test.input), qt.Equals, test.expected) } } @@ -82,5 +79,4 @@ func BenchmarkGetGlob(b *testing.B) { b.Fatal(err) } } - } diff --git a/hugofs/glob_test.go b/hugofs/glob_test.go index 3c7780685..b18864ef2 100644 --- a/hugofs/glob_test.go +++ b/hugofs/glob_test.go @@ -57,5 +57,4 @@ func TestGlob(t *testing.T) { c.Assert(collect("*.json"), qt.HasLen, 1) c.Assert(collect("**.xml"), qt.HasLen, 1) c.Assert(collect(filepath.FromSlash("/jsonfiles/*.json")), qt.HasLen, 2) - } diff --git a/hugofs/hashing_fs.go b/hugofs/hashing_fs.go index 94a50b960..d7b6329c9 100644 --- a/hugofs/hashing_fs.go +++ b/hugofs/hashing_fs.go @@ -22,9 +22,7 @@ import ( "github.com/spf13/afero" ) -var ( - _ afero.Fs = (*md5HashingFs)(nil) -) +var _ afero.Fs = (*md5HashingFs)(nil) // FileHashReceiver will receive the filename an the content's MD5 sum on file close. type FileHashReceiver interface { diff --git a/hugofs/hashing_fs_test.go b/hugofs/hashing_fs_test.go index b2bfb78f4..3e1f6c41d 100644 --- a/hugofs/hashing_fs_test.go +++ b/hugofs/hashing_fs_test.go @@ -49,5 +49,4 @@ func TestHashingFs(t *testing.T) { c.Assert(err, qt.IsNil) c.Assert(f.Close(), qt.IsNil) c.Assert(observer.sum, qt.Equals, "d41d8cd98f00b204e9800998ecf8427e") - } diff --git a/hugofs/nosymlink_fs.go b/hugofs/nosymlink_fs.go index fa89d61e0..e55d369e9 100644 --- a/hugofs/nosymlink_fs.go +++ b/hugofs/nosymlink_fs.go @@ -23,9 +23,7 @@ import ( "github.com/spf13/afero" ) -var ( - ErrPermissionSymlink = errors.New("symlinks not allowed in this filesystem") -) +var ErrPermissionSymlink = errors.New("symlinks not allowed in this filesystem") // NewNoSymlinkFs creates a new filesystem that prevents symlinks. func NewNoSymlinkFs(fs afero.Fs, logger loggers.Logger, allowFiles bool) afero.Fs { @@ -79,7 +77,6 @@ func (fs *noSymlinkFs) Stat(name string) (os.FileInfo, error) { } func (fs *noSymlinkFs) stat(name string) (os.FileInfo, bool, error) { - var ( fi os.FileInfo wasLstat bool diff --git a/hugofs/nosymlink_test.go b/hugofs/nosymlink_test.go index f541fc0a7..99151ec67 100644 --- a/hugofs/nosymlink_test.go +++ b/hugofs/nosymlink_test.go @@ -143,5 +143,4 @@ func TestNoSymlinkFs(t *testing.T) { } } - } diff --git a/hugofs/rootmapping_fs.go b/hugofs/rootmapping_fs.go index a38560d0a..4ffdb9c66 100644 --- a/hugofs/rootmapping_fs.go +++ b/hugofs/rootmapping_fs.go @@ -27,9 +27,7 @@ import ( "github.com/spf13/afero" ) -var ( - filepathSeparator = string(filepath.Separator) -) +var filepathSeparator = string(filepath.Separator) // NewRootMappingFs creates a new RootMappingFs on top of the provided with // root mappings with some optional metadata about the root. @@ -102,7 +100,6 @@ func newRootMappingFsFromFromTo( fs afero.Fs, fromTo ...string, ) (*RootMappingFs, error) { - rms := make([]RootMapping, len(fromTo)/2) for i, j := 0, 0; j < len(fromTo); i, j = i+1, j+2 { rms[i] = RootMapping{ @@ -223,7 +220,6 @@ func (fs *RootMappingFs) LstatIfPossible(name string) (os.FileInfo, bool, error) // Open opens the named file for reading. func (fs *RootMappingFs) Open(name string) (afero.File, error) { fis, err := fs.doLstat(name) - if err != nil { return nil, err } @@ -236,7 +232,6 @@ func (fs *RootMappingFs) Open(name string) (afero.File, error) { func (fs *RootMappingFs) Stat(name string) (os.FileInfo, error) { fi, _, err := fs.LstatIfPossible(name) return fi, err - } func (fs *RootMappingFs) hasPrefix(prefix string) bool { @@ -264,7 +259,6 @@ func (fs *RootMappingFs) getRoots(key string) (string, []RootMapping) { return "", nil } return s, v.([]RootMapping) - } func (fs *RootMappingFs) debug() { @@ -273,7 +267,6 @@ func (fs *RootMappingFs) debug() { fmt.Println("Key", s) return false }) - } func (fs *RootMappingFs) getRootsWithPrefix(prefix string) []RootMapping { @@ -347,7 +340,6 @@ func (fs *RootMappingFs) newUnionFile(fis ...FileMetaInfo) (afero.File, error) { } return uf, nil - } func (fs *RootMappingFs) cleanName(name string) string { @@ -407,7 +399,6 @@ func (fs *RootMappingFs) collectDirEntries(prefix string) ([]os.FileInfo, error) // Next add any file mounts inside the given directory. prefixInside := prefix + filepathSeparator fs.rootMapToReal.WalkPrefix(prefixInside, func(s string, v interface{}) bool { - if (strings.Count(s, filepathSeparator) - level) != 1 { // This directory is not part of the current, but we // need to include the first name part to make it @@ -534,11 +525,9 @@ func (fs *RootMappingFs) doLstat(name string) ([]FileMetaInfo, error) { if fileCount > 1 { // Not supported by this filesystem. return nil, errors.Errorf("found multiple files with name %q, use .Readdir or the source filesystem directly", name) - } return []FileMetaInfo{roots[0].fi}, nil - } func (fs *RootMappingFs) statRoot(root RootMapping, name string) (FileMetaInfo, bool, error) { @@ -561,7 +550,6 @@ func (fs *RootMappingFs) statRoot(root RootMapping, name string) (FileMetaInfo, } return decorateFileInfo(fi, fs.Fs, opener, "", "", root.Meta), b, nil - } func (fs *RootMappingFs) virtualDirOpener(name string) func() (afero.File, error) { diff --git a/hugofs/rootmapping_fs_test.go b/hugofs/rootmapping_fs_test.go index b2552431a..e5f68d7a9 100644 --- a/hugofs/rootmapping_fs_test.go +++ b/hugofs/rootmapping_fs_test.go @@ -138,7 +138,6 @@ func TestLanguageRootMapping(t *testing.T) { c.Assert(getDirnames("content", rfsSv), qt.DeepEquals, []string{"blog", "docs"}) c.Assert(getDirnames("content", rfs), qt.DeepEquals, []string{"blog", "docs"}) - } func TestRootMappingFsDirnames(t *testing.T) { @@ -166,7 +165,6 @@ func TestRootMappingFsDirnames(t *testing.T) { dirnames, err := root.Readdirnames(-1) c.Assert(err, qt.IsNil) c.Assert(dirnames, qt.DeepEquals, []string{"af3", "bf1", "cf2"}) - } func TestRootMappingFsFilename(t *testing.T) { @@ -208,29 +206,29 @@ func TestRootMappingFsMount(t *testing.T) { bfs := afero.NewBasePathFs(fs, "themes/a").(*afero.BasePathFs) rm := []RootMapping{ // Directories - RootMapping{ + { From: "content/blog", To: "mynoblogcontent", Meta: FileMeta{"lang": "no"}, }, - RootMapping{ + { From: "content/blog", To: "myenblogcontent", Meta: FileMeta{"lang": "en"}, }, - RootMapping{ + { From: "content/blog", To: "mysvblogcontent", Meta: FileMeta{"lang": "sv"}, }, // Files - RootMapping{ + { From: "content/singles/p1.md", To: "singlefiles/no.txt", ToBasedir: "singlefiles", Meta: FileMeta{"lang": "no"}, }, - RootMapping{ + { From: "content/singles/p1.md", To: "singlefiles/sv.txt", ToBasedir: "singlefiles", @@ -300,19 +298,19 @@ func TestRootMappingFsMountOverlap(t *testing.T) { c.Assert(afero.WriteFile(fs, filepath.FromSlash("de/e.txt"), []byte("some no content"), 0755), qt.IsNil) rm := []RootMapping{ - RootMapping{ + { From: "static", To: "da", }, - RootMapping{ + { From: "static/b", To: "db", }, - RootMapping{ + { From: "static/b/c", To: "dc", }, - RootMapping{ + { From: "/static/e/", To: "de", }, @@ -339,7 +337,6 @@ func TestRootMappingFsMountOverlap(t *testing.T) { fi, err := rfs.Stat(filepath.FromSlash("static/b/b.txt")) c.Assert(err, qt.IsNil) c.Assert(fi.Name(), qt.Equals, "b.txt") - } func TestRootMappingFsOs(t *testing.T) { @@ -485,5 +482,4 @@ func TestRootMappingFsOsBase(t *testing.T) { } c.Assert(getDirnames("static/a/b/c"), qt.DeepEquals, []string{"d4", "f-1.txt", "f-2.txt", "f-3.txt", "ms-1.txt"}) - } diff --git a/hugofs/slice_fs.go b/hugofs/slice_fs.go index 4fb026ab2..f1682c1b8 100644 --- a/hugofs/slice_fs.go +++ b/hugofs/slice_fs.go @@ -45,7 +45,6 @@ func NewSliceFs(dirs ...FileMetaInfo) (afero.Fs, error) { } return fs, nil - } // SliceFs is an ordered composite filesystem. @@ -63,7 +62,6 @@ func (fs *SliceFs) Chtimes(n string, a, m time.Time) error { func (fs *SliceFs) LstatIfPossible(name string) (os.FileInfo, bool, error) { fi, _, err := fs.pickFirst(name) - if err != nil { return nil, false, err } @@ -73,7 +71,6 @@ func (fs *SliceFs) LstatIfPossible(name string) (os.FileInfo, bool, error) { } return nil, false, errors.Errorf("lstat: files not supported: %q", name) - } func (fs *SliceFs) Mkdir(n string, p os.FileMode) error { @@ -103,7 +100,6 @@ func (fs *SliceFs) Open(name string) (afero.File, error) { idx: idx, dirname: name, }, nil - } func (fs *SliceFs) OpenFile(name string, flag int, perm os.FileMode) (afero.File, error) { @@ -222,7 +218,6 @@ func (fs *SliceFs) readDirs(name string, startIdx, count int) ([]os.FileInfo, er } return dirs, nil - } type sliceDir struct { diff --git a/hugofs/walk.go b/hugofs/walk.go index 91dd386e2..a46b36e50 100644 --- a/hugofs/walk.go +++ b/hugofs/walk.go @@ -98,7 +98,8 @@ func NewWalkway(cfg WalkwayConfig) *Walkway { hookPre: cfg.HookPre, hookPost: cfg.HookPost, logger: logger, - seen: make(map[string]bool)} + seen: make(map[string]bool), + } } func (w *Walkway) Walk() error { @@ -134,7 +135,6 @@ func (w *Walkway) Walk() error { } return w.walk(w.root, fi, w.dirEntries, w.walkFn) - } // if the filesystem supports it, use Lstat, else use fs.Stat diff --git a/hugofs/walk_test.go b/hugofs/walk_test.go index c38c6044f..d5ae33a34 100644 --- a/hugofs/walk_test.go +++ b/hugofs/walk_test.go @@ -56,16 +56,16 @@ func TestWalkRootMappingFs(t *testing.T) { c.Assert(afero.WriteFile(fs, filepath.Join("e/f", testfile), []byte("some content"), 0755), qt.IsNil) rm := []RootMapping{ - RootMapping{ + { From: "static/b", To: "e/f", }, - RootMapping{ + { From: "static/a", To: "c/d", }, - RootMapping{ + { From: "static/c", To: "a/b", }, @@ -79,7 +79,6 @@ func TestWalkRootMappingFs(t *testing.T) { c.Assert(err, qt.IsNil) c.Assert(names, qt.DeepEquals, []string{"a/test.txt", "b/test.txt", "c/test.txt"}) - } func skipSymlink() bool { @@ -137,7 +136,6 @@ func TestWalkSymbolicLink(t *testing.T) { // Note: the docsreal folder is considered cyclic when walking from the root, but this works. c.Assert(names, qt.DeepEquals, []string{"b.txt", "docsreal/sub/a.txt"}) }) - } func collectFilenames(fs afero.Fs, base, root string) ([]string, error) { @@ -165,7 +163,6 @@ func collectFilenames(fs afero.Fs, base, root string) ([]string, error) { err := w.Walk() return names, err - } func collectFileinfos(fs afero.Fs, base, root string) ([]FileMetaInfo, error) { @@ -186,7 +183,6 @@ func collectFileinfos(fs afero.Fs, base, root string) ([]FileMetaInfo, error) { err := w.Walk() return fis, err - } func BenchmarkWalk(b *testing.B) { @@ -234,5 +230,4 @@ func BenchmarkWalk(b *testing.B) { b.Fatal(err) } } - } |