From d90e37e0c6e812f9913bf256c9c81aa05b7a08aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Wed, 2 Dec 2020 13:23:25 +0100 Subject: all: Format code with gofumpt See https://github.com/mvdan/gofumpt --- hugofs/decorators.go | 6 ------ hugofs/fileinfo.go | 5 +---- hugofs/files/classifier.go | 6 ++++-- hugofs/files/classifier_test.go | 2 -- hugofs/filter_fs.go | 10 ---------- hugofs/filter_fs_test.go | 2 -- hugofs/fs.go | 6 ++---- hugofs/fs_test.go | 2 -- hugofs/glob.go | 1 - hugofs/glob/glob.go | 2 -- hugofs/glob/glob_test.go | 4 ---- hugofs/glob_test.go | 1 - hugofs/hashing_fs.go | 4 +--- hugofs/hashing_fs_test.go | 1 - hugofs/nosymlink_fs.go | 5 +---- hugofs/nosymlink_test.go | 1 - hugofs/rootmapping_fs.go | 14 +------------- hugofs/rootmapping_fs_test.go | 22 +++++++++------------- hugofs/slice_fs.go | 5 ----- hugofs/walk.go | 4 ++-- hugofs/walk_test.go | 11 +++-------- 21 files changed, 24 insertions(+), 90 deletions(-) (limited to 'hugofs') 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("