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 /create | |
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 'create')
-rw-r--r-- | create/content.go | 10 | ||||
-rw-r--r-- | create/content_template_handler.go | 2 | ||||
-rw-r--r-- | create/content_test.go | 10 |
3 files changed, 5 insertions, 17 deletions
diff --git a/create/content.go b/create/content.go index 13e668201..d1594a199 100644 --- a/create/content.go +++ b/create/content.go @@ -16,15 +16,14 @@ package create import ( "bytes" - - "github.com/pkg/errors" - "io" "os" "os/exec" "path/filepath" "strings" + "github.com/pkg/errors" + "github.com/gohugoio/hugo/hugofs/files" "github.com/gohugoio/hugo/hugofs" @@ -131,7 +130,6 @@ func newContentFromDir( sites *hugolib.HugoSites, targetFs afero.Fs, cm archetypeMap, name, targetPath string) error { - for _, f := range cm.otherFiles { meta := f.Meta() filename := meta.Path() @@ -196,11 +194,9 @@ func mapArcheTypeDir( ps *helpers.PathSpec, fs afero.Fs, archetypeDir string) (archetypeMap, error) { - var m archetypeMap walkFn := func(path string, fi hugofs.FileMetaInfo, err error) error { - if err != nil { return err } @@ -308,7 +304,6 @@ func resolveContentPath(sites *hugolib.HugoSites, fs afero.Fs, targetPath string } if siteContentDir == "" { - } if siteContentDir != "" { @@ -324,7 +319,6 @@ func resolveContentPath(sites *hugolib.HugoSites, fs afero.Fs, targetPath string } return s.PathSpec.AbsPathify(filepath.Join(contentDir, targetPath)), s } - } // FindArchetype takes a given kind/archetype of content and returns the path diff --git a/create/content_template_handler.go b/create/content_template_handler.go index 3a7007f1a..3e9701e4b 100644 --- a/create/content_template_handler.go +++ b/create/content_template_handler.go @@ -83,7 +83,6 @@ var ( ) func executeArcheTypeAsTemplate(s *hugolib.Site, name, kind, targetPath, archetypeFilename string) ([]byte, error) { - var ( archetypeContent []byte archetypeTemplate []byte @@ -145,5 +144,4 @@ func executeArcheTypeAsTemplate(s *hugolib.Site, name, kind, targetPath, archety archetypeContent = []byte(archetypeShortcodeReplacementsPost.Replace(buff.String())) return archetypeContent, nil - } diff --git a/create/content_test.go b/create/content_test.go index f43d3a5f4..37dbf98bd 100644 --- a/create/content_test.go +++ b/create/content_test.go @@ -14,6 +14,7 @@ package create_test import ( + "fmt" "os" "path/filepath" "strings" @@ -23,8 +24,6 @@ import ( "github.com/gohugoio/hugo/hugolib" - "fmt" - "github.com/gohugoio/hugo/hugofs" qt "github.com/frankban/quicktest" @@ -35,7 +34,6 @@ import ( ) func TestNewContent(t *testing.T) { - cases := []struct { kind string path string @@ -59,7 +57,8 @@ func TestNewContent(t *testing.T) { `title = "GO"`, "{{< myshortcode >}}", "{{% myshortcode %}}", - "{{</* comment */>}}\n{{%/* comment */%}}"}}, // shortcodes + "{{</* comment */>}}\n{{%/* comment */%}}", + }}, // shortcodes } for i, cas := range cases { @@ -140,7 +139,6 @@ i18n: {{ T "hugo" }} c.Assert(create.NewContent(h, "my-theme-bundle", "post/my-theme-post"), qt.IsNil) cContains(c, readFileFromFs(t, fs.Source, filepath.Join("content", "post/my-theme-post/index.md")), `File: index.md`, `Site Lang: en`, `Name: My Theme Post`, `i18n: Hugo Rocks!`) cContains(c, readFileFromFs(t, fs.Source, filepath.Join("content", "post/my-theme-post/resources/hugo1.json")), `hugo1: {{ printf "no template handling in here" }}`) - } func initFs(fs afero.Fs) error { @@ -248,7 +246,6 @@ func readFileFromFs(t *testing.T, fs afero.Fs, filename string) string { } func newTestCfg(c *qt.C, mm afero.Fs) (*viper.Viper, *hugofs.Fs) { - cfg := ` theme = "mytheme" @@ -281,5 +278,4 @@ other = "Hugo Rokkar!"`), 0755), qt.IsNil) c.Assert(err, qt.IsNil) return v, hugofs.NewFrom(mm, v) - } |