all: Format code with gofumpt

See https://github.com/mvdan/gofumpt
This commit is contained in:
Bjørn Erik Pedersen
2020-12-02 13:23:25 +01:00
parent 32471b57bd
commit d90e37e0c6
442 changed files with 1426 additions and 2254 deletions

View File

@@ -232,7 +232,6 @@ func (sp *SourceSpec) NewFileInfoFrom(path, filename string) (*FileInfo, error)
}
func (sp *SourceSpec) NewFileInfo(fi hugofs.FileMetaInfo) (*FileInfo, error) {
m := fi.Meta()
filename := m.Filename()
@@ -290,5 +289,4 @@ func (sp *SourceSpec) NewFileInfo(fi hugofs.FileMetaInfo) (*FileInfo, error) {
}
return f, nil
}

View File

@@ -38,18 +38,15 @@ func TestFileInfo(t *testing.T) {
c.Assert(f.Section(), qt.Equals, "b")
c.Assert(f.TranslationBaseName(), qt.Equals, filepath.FromSlash("page"))
c.Assert(f.BaseFileName(), qt.Equals, filepath.FromSlash("page"))
}},
{filepath.FromSlash("/a/"), filepath.FromSlash("/a/b/c/d/page.md"), func(f *FileInfo) {
c.Assert(f.Section(), qt.Equals, "b")
}},
{filepath.FromSlash("/a/"), filepath.FromSlash("/a/b/page.en.MD"), func(f *FileInfo) {
c.Assert(f.Section(), qt.Equals, "b")
c.Assert(f.Path(), qt.Equals, filepath.FromSlash("b/page.en.MD"))
c.Assert(f.TranslationBaseName(), qt.Equals, filepath.FromSlash("page"))
c.Assert(f.BaseFileName(), qt.Equals, filepath.FromSlash("page.en"))
}},
} {
path := strings.TrimPrefix(this.filename, this.base)
@@ -57,5 +54,4 @@ func TestFileInfo(t *testing.T) {
c.Assert(err, qt.IsNil)
this.assert(f)
}
}

View File

@@ -102,11 +102,9 @@ func (f *Filesystem) captureFiles() error {
})
return w.Walk()
}
func (f *Filesystem) shouldRead(filename string, fi hugofs.FileMetaInfo) (bool, error) {
ignore := f.SourceSpec.IgnoreFile(fi.Meta().Filename())
if fi.IsDir() {

View File

@@ -74,7 +74,6 @@ func TestUnicodeNorm(t *testing.T) {
t.Fatalf("file %q name in NFD form should be normalized (%s)", f.BaseFileName(), path.NFC)
}
}
}
func newTestConfig() *viper.Viper {

View File

@@ -74,7 +74,6 @@ func NewSourceSpec(ps *helpers.PathSpec, fs afero.Fs) *SourceSpec {
}
return &SourceSpec{ignoreFilesRe: regexps, PathSpec: ps, SourceFs: fs, Languages: languages, DefaultContentLanguage: defaultLang, DisabledLanguages: disabledLangsSet}
}
// IgnoreFile returns whether a given file should be ignored.