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 --- helpers/content.go | 6 +----- helpers/content_test.go | 4 +--- helpers/docshelper.go | 3 --- helpers/emoji.go | 1 - helpers/emoji_test.go | 8 ++------ helpers/general.go | 2 -- helpers/general_test.go | 3 --- helpers/path.go | 16 ++-------------- helpers/path_test.go | 21 ++++++++------------- helpers/pathspec.go | 2 -- helpers/pathspec_test.go | 1 - helpers/processing_stats.go | 3 --- helpers/testhelpers_test.go | 1 - helpers/url.go | 5 +---- helpers/url_test.go | 3 --- 15 files changed, 15 insertions(+), 64 deletions(-) (limited to 'helpers') diff --git a/helpers/content.go b/helpers/content.go index c59e41a8c..5e56ad6bf 100644 --- a/helpers/content.go +++ b/helpers/content.go @@ -20,6 +20,7 @@ package helpers import ( "bytes" "html/template" + "strings" "unicode" "unicode/utf8" @@ -33,8 +34,6 @@ import ( bp "github.com/gohugoio/hugo/bufferpool" "github.com/gohugoio/hugo/config" - - "strings" ) // SummaryDivider denotes where content summarization should end. The default is "". @@ -66,7 +65,6 @@ type ContentSpec struct { // NewContentSpec returns a ContentSpec initialized // with the appropriate fields from the given config.Provider. func NewContentSpec(cfg config.Provider, logger loggers.Logger, contentFs afero.Fs) (*ContentSpec, error) { - spec := &ContentSpec{ summaryLength: cfg.GetInt("summaryLength"), BuildFuture: cfg.GetBool("buildFuture"), @@ -81,7 +79,6 @@ func NewContentSpec(cfg config.Provider, logger loggers.Logger, contentFs afero. ContentFs: contentFs, Logger: logger, }) - if err != nil { return nil, err } @@ -112,7 +109,6 @@ var stripHTMLReplacer = strings.NewReplacer("\n", " ", "

", "\n", "
", "\n // StripHTML accepts a string, strips out all HTML tags and returns it. func StripHTML(s string) string { - // Shortcut strings with no tags in them if !strings.ContainsAny(s, "<>") { return s diff --git a/helpers/content_test.go b/helpers/content_test.go index 86e5412c2..573c1c90d 100644 --- a/helpers/content_test.go +++ b/helpers/content_test.go @@ -118,7 +118,6 @@ func TestNewContentSpec(t *testing.T) { c.Assert(spec.BuildFuture, qt.Equals, true) c.Assert(spec.BuildExpired, qt.Equals, true) c.Assert(spec.BuildDrafts, qt.Equals, true) - } var benchmarkTruncateString = strings.Repeat("This is a sentence about nothing.", 20) @@ -225,7 +224,7 @@ func TestExtractTOCGreaterThanSeventy(t *testing.T) { content := []byte("