summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2024-01-28 22:34:10 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2024-01-28 23:14:09 +0100
commita795acbcd8b18aa4af384d5c03f30740361c8fcf (patch)
tree0dbf7b000681a738b892c5235daf52c63cda88b9
parent982d9513e71b3d48e20cfa38454a0e1215a8d963 (diff)
all: Run gofumpt -l -w .
-rw-r--r--cache/filecache/filecache_config.go4
-rw-r--r--cache/filecache/filecache_pruner.go2
-rw-r--r--codegen/methods.go1
-rw-r--r--common/collections/append_test.go12
-rw-r--r--common/collections/slice.go1
-rw-r--r--common/collections/slice_test.go1
-rw-r--r--common/hexec/exec.go6
-rw-r--r--common/htime/time_test.go4
-rw-r--r--common/maps/maps_test.go1
-rw-r--r--common/maps/params_test.go1
-rw-r--r--common/paths/url.go1
-rw-r--r--common/text/transform_test.go4
-rw-r--r--common/types/convert.go1
-rw-r--r--common/types/convert_test.go1
-rw-r--r--compare/compare_strings_test.go1
-rw-r--r--config/allconfig/load_test.go2
-rw-r--r--config/configLoader.go1
-rw-r--r--config/defaultConfigProvider.go1
-rw-r--r--config/env.go1
-rw-r--r--config/security/whitelist_test.go1
-rw-r--r--deploy/deployConfig.go4
-rw-r--r--htesting/test_helpers_test.go2
-rw-r--r--hugofs/createcounting_fs.go4
-rw-r--r--hugofs/glob/glob_test.go1
-rw-r--r--hugolib/404_test.go4
-rw-r--r--hugolib/config.go7
-rw-r--r--hugolib/language_test.go4
-rw-r--r--langs/language_test.go3
-rw-r--r--lazy/init_test.go1
-rw-r--r--markup/goldmark/images/transform.go2
-rw-r--r--markup/goldmark/internal/extensions/attributes/attributes.go4
-rw-r--r--markup/internal/external.go3
-rw-r--r--markup/markup_config/config_test.go2
-rw-r--r--markup/pandoc/convert.go3
-rw-r--r--markup/rst/convert.go3
-rw-r--r--markup/tableofcontents/tableofcontents_test.go2
-rw-r--r--media/builtin.go102
-rw-r--r--minifiers/minifiers_test.go5
-rw-r--r--modules/client.go14
-rw-r--r--modules/config_test.go1
-rw-r--r--modules/module.go2
-rw-r--r--navigation/pagemenus.go5
-rw-r--r--output/docshelper.go1
-rw-r--r--output/layouts/layout_test.go1
-rw-r--r--output/outputFormat_test.go1
-rw-r--r--parser/metadecoders/decoder_test.go11
-rw-r--r--parser/pageparser/item_test.go1
-rw-r--r--parser/pageparser/pagelexer_shortcode.go1
-rw-r--r--publisher/htmlElementsCollector.go2
-rw-r--r--publisher/htmlElementsCollector_test.go7
-rw-r--r--related/inverted_index_test.go1
-rw-r--r--resources/images/color.go1
-rw-r--r--resources/page/page_matcher_test.go4
-rw-r--r--resources/resource_factories/create/remote_test.go2
-rw-r--r--resources/resource_transformers/tocss/dartsass/dartsass_integration_test.go5
-rw-r--r--resources/resource_transformers/tocss/scss/client_extended.go1
-rw-r--r--resources/resource_transformers/tocss/scss/scss_integration_test.go3
-rw-r--r--tpl/cast/cast.go3
-rw-r--r--tpl/collections/merge.go3
-rw-r--r--tpl/collections/reflect_helpers.go3
-rw-r--r--tpl/collections/where_test.go3
-rw-r--r--tpl/crypto/crypto.go3
-rw-r--r--tpl/css/css.go3
-rw-r--r--tpl/data/data_test.go10
-rw-r--r--tpl/images/images.go3
-rw-r--r--tpl/images/images_test.go2
-rw-r--r--tpl/internal/templatefuncRegistry_test.go3
-rw-r--r--tpl/math/math.go1
-rw-r--r--tpl/path/path.go1
-rw-r--r--tpl/strings/regexp.go1
-rw-r--r--tpl/strings/regexp_test.go1
-rw-r--r--tpl/strings/truncate_test.go1
-rw-r--r--tpl/time/time_test.go4
-rw-r--r--tpl/tplimpl/shortcodes.go1
-rw-r--r--tpl/transform/remarshal.go3
-rw-r--r--tpl/urls/urls.go1
-rw-r--r--watcher/filenotify/poller.go2
77 files changed, 109 insertions, 210 deletions
diff --git a/cache/filecache/filecache_config.go b/cache/filecache/filecache_config.go
index 1d57fe72e..6a2b5f3e3 100644
--- a/cache/filecache/filecache_config.go
+++ b/cache/filecache/filecache_config.go
@@ -15,6 +15,7 @@
package filecache
import (
+ "errors"
"fmt"
"path"
"path/filepath"
@@ -24,8 +25,6 @@ import (
"github.com/gohugoio/hugo/common/maps"
"github.com/gohugoio/hugo/config"
- "errors"
-
"github.com/mitchellh/mapstructure"
"github.com/spf13/afero"
)
@@ -225,7 +224,6 @@ func DecodeConfig(fs afero.Fs, bcfg config.BaseConfig, m map[string]any) (Config
// Resolves :resourceDir => /myproject/resources etc., :cacheDir => ...
func resolveDirPlaceholder(fs afero.Fs, bcfg config.BaseConfig, placeholder string) (cacheDir string, isResource bool, err error) {
-
switch strings.ToLower(placeholder) {
case ":resourcedir":
return "", true, nil
diff --git a/cache/filecache/filecache_pruner.go b/cache/filecache/filecache_pruner.go
index 2ad6c0bb7..6f224cef4 100644
--- a/cache/filecache/filecache_pruner.go
+++ b/cache/filecache/filecache_pruner.go
@@ -60,7 +60,6 @@ func (c *Cache) Prune(force bool) (int, error) {
counter := 0
err := afero.Walk(c.Fs, "", func(name string, info os.FileInfo, err error) error {
-
if info == nil {
return nil
}
@@ -69,7 +68,6 @@ func (c *Cache) Prune(force bool) (int, error) {
if info.IsDir() {
f, err := c.Fs.Open(name)
-
if err != nil {
// This cache dir may not exist.
return nil
diff --git a/codegen/methods.go b/codegen/methods.go
index 65a7cc2b7..299063bb5 100644
--- a/codegen/methods.go
+++ b/codegen/methods.go
@@ -461,7 +461,6 @@ func collectMethodsRecursive(pkg string, f []*ast.Field) []string {
pkg,
tt.Methods.List)...)
}
-
} else {
// Embedded, but in a different file/package. Return the
// package.Name and deal with that later.
diff --git a/common/collections/append_test.go b/common/collections/append_test.go
index 3c2aab2db..f791b731a 100644
--- a/common/collections/append_test.go
+++ b/common/collections/append_test.go
@@ -55,7 +55,7 @@ func TestAppend(t *testing.T) {
[]any{&tstSlicerIn1{"c"}},
testSlicerInterfaces{&tstSlicerIn1{"a"}, &tstSlicerIn1{"b"}, &tstSlicerIn1{"c"}},
},
- //https://github.com/gohugoio/hugo/issues/5361
+ // https://github.com/gohugoio/hugo/issues/5361
{
[]string{"a", "b"},
[]any{tstSlicers{&tstSlicer{"a"}, &tstSlicer{"b"}}},
@@ -102,14 +102,16 @@ func TestAppendToMultiDimensionalSlice(t *testing.T) {
from []any
expected any
}{
- {[][]string{{"a", "b"}},
+ {
+ [][]string{{"a", "b"}},
[]any{[]string{"c", "d"}},
[][]string{
{"a", "b"},
{"c", "d"},
},
},
- {[][]string{{"a", "b"}},
+ {
+ [][]string{{"a", "b"}},
[]any{[]string{"c", "d"}, []string{"e", "f"}},
[][]string{
{"a", "b"},
@@ -117,7 +119,8 @@ func TestAppendToMultiDimensionalSlice(t *testing.T) {
{"e", "f"},
},
},
- {[][]string{{"a", "b"}},
+ {
+ [][]string{{"a", "b"}},
[]any{[]int{1, 2}},
false,
},
@@ -130,7 +133,6 @@ func TestAppendToMultiDimensionalSlice(t *testing.T) {
c.Assert(result, qt.DeepEquals, test.expected)
}
}
-
}
func TestAppendShouldMakeACopyOfTheInputSlice(t *testing.T) {
diff --git a/common/collections/slice.go b/common/collections/slice.go
index bf5c7b52b..731f489f9 100644
--- a/common/collections/slice.go
+++ b/common/collections/slice.go
@@ -73,7 +73,6 @@ func StringSliceToInterfaceSlice(ss []string) []any {
result[i] = s
}
return result
-
}
type SortedStringSlice []string
diff --git a/common/collections/slice_test.go b/common/collections/slice_test.go
index 5788b9161..20961aac0 100644
--- a/common/collections/slice_test.go
+++ b/common/collections/slice_test.go
@@ -135,5 +135,4 @@ func TestSortedStringSlice(t *testing.T) {
c.Assert(s.Count("b"), qt.Equals, 3)
c.Assert(s.Count("z"), qt.Equals, 0)
c.Assert(s.Count("a"), qt.Equals, 1)
-
}
diff --git a/common/hexec/exec.go b/common/hexec/exec.go
index 95e5162fc..12775bd1c 100644
--- a/common/hexec/exec.go
+++ b/common/hexec/exec.go
@@ -19,11 +19,10 @@ import (
"errors"
"fmt"
"io"
- "regexp"
- "strings"
-
"os"
"os/exec"
+ "regexp"
+ "strings"
"github.com/cli/safeexec"
"github.com/gohugoio/hugo/config"
@@ -142,7 +141,6 @@ func (e *Exec) New(name string, arg ...any) (Runner, error) {
}
return cm.command(arg...)
-
}
// Npx is a convenience method to create a Runner running npx --no-install <name> <args.
diff --git a/common/htime/time_test.go b/common/htime/time_test.go
index 6cb323409..78954887e 100644
--- a/common/htime/time_test.go
+++ b/common/htime/time_test.go
@@ -53,7 +53,6 @@ func TestTimeFormatter(t *testing.T) {
c.Assert(f.Format(june06, ":time_long"), qt.Equals, "02:09:37 UTC")
c.Assert(f.Format(june06, ":time_medium"), qt.Equals, "02:09:37")
c.Assert(f.Format(june06, ":time_short"), qt.Equals, "02:09")
-
})
c.Run("Custom layouts English", func(c *qt.C) {
@@ -68,7 +67,6 @@ func TestTimeFormatter(t *testing.T) {
c.Assert(f.Format(june06, ":time_long"), qt.Equals, "2:09:37 am UTC")
c.Assert(f.Format(june06, ":time_medium"), qt.Equals, "2:09:37 am")
c.Assert(f.Format(june06, ":time_short"), qt.Equals, "2:09 am")
-
})
c.Run("English", func(c *qt.C) {
@@ -107,9 +105,7 @@ func TestTimeFormatter(t *testing.T) {
c.Assert(tr.MonthWide(date.Month()), qt.Equals, monthWideNorway)
c.Assert(f.Format(date, "January"), qt.Equals, monthWideNorway)
}
-
})
-
}
func BenchmarkTimeFormatter(b *testing.B) {
diff --git a/common/maps/maps_test.go b/common/maps/maps_test.go
index 0e8589d34..098098388 100644
--- a/common/maps/maps_test.go
+++ b/common/maps/maps_test.go
@@ -192,5 +192,4 @@ func TestLookupEqualFold(t *testing.T) {
v, found = LookupEqualFold(m2, "b")
c.Assert(found, qt.IsTrue)
c.Assert(v, qt.Equals, "bv")
-
}
diff --git a/common/maps/params_test.go b/common/maps/params_test.go
index 578b2a576..892c77175 100644
--- a/common/maps/params_test.go
+++ b/common/maps/params_test.go
@@ -154,7 +154,6 @@ func TestParamsSetAndMerge(t *testing.T) {
"a": "av",
"c": "cv",
})
-
}
func TestParamsIsZero(t *testing.T) {
diff --git a/common/paths/url.go b/common/paths/url.go
index 4c4a7f2dc..75b4b644a 100644
--- a/common/paths/url.go
+++ b/common/paths/url.go
@@ -163,7 +163,6 @@ func Uglify(in string) string {
// If ParseRequestURI fails, the input is just converted to OS specific slashes and returned.
func UrlToFilename(s string) (string, bool) {
u, err := url.ParseRequestURI(s)
-
if err != nil {
return filepath.FromSlash(s), false
}
diff --git a/common/text/transform_test.go b/common/text/transform_test.go
index 41447715f..74bb37783 100644
--- a/common/text/transform_test.go
+++ b/common/text/transform_test.go
@@ -57,7 +57,6 @@ line 3`
c := qt.New(t)
c.Assert(collected, qt.DeepEquals, []string{"line 1\n", "line 2\n", "\n", "line 3"})
-
}
func BenchmarkVisitLinesAfter(b *testing.B) {
@@ -68,9 +67,6 @@ func BenchmarkVisitLinesAfter(b *testing.B) {
for i := 0; i < b.N; i++ {
VisitLinesAfter(lines, func(s string) {
-
})
-
}
-
}
diff --git a/common/types/convert.go b/common/types/convert.go
index fbeab5b91..0cb5035df 100644
--- a/common/types/convert.go
+++ b/common/types/convert.go
@@ -80,7 +80,6 @@ func ToStringSlicePreserveStringE(v any) ([]string, error) {
default:
return nil, fmt.Errorf("failed to convert %T to a string slice", v)
}
-
}
// TypeToString converts v to a string if it's a valid string type.
diff --git a/common/types/convert_test.go b/common/types/convert_test.go
index 215117441..13059285d 100644
--- a/common/types/convert_test.go
+++ b/common/types/convert_test.go
@@ -45,5 +45,4 @@ func TestToDuration(t *testing.T) {
c.Assert(ToDuration("200"), qt.Equals, 200*time.Millisecond)
c.Assert(ToDuration("4m"), qt.Equals, 4*time.Minute)
c.Assert(ToDuration("asdfadf"), qt.Equals, time.Duration(0))
-
}
diff --git a/compare/compare_strings_test.go b/compare/compare_strings_test.go
index a73091fc6..1a5bb0b1a 100644
--- a/compare/compare_strings_test.go
+++ b/compare/compare_strings_test.go
@@ -79,5 +79,4 @@ func BenchmarkStringSort(b *testing.B) {
})
}
})
-
}
diff --git a/config/allconfig/load_test.go b/config/allconfig/load_test.go
index 153a59c44..3c16e71e9 100644
--- a/config/allconfig/load_test.go
+++ b/config/allconfig/load_test.go
@@ -50,7 +50,7 @@ weight = 3
title = "Svenska"
weight = 4
`
- if err := os.WriteFile(configFilename, []byte(config), 0666); err != nil {
+ if err := os.WriteFile(configFilename, []byte(config), 0o666); err != nil {
b.Fatal(err)
}
d := ConfigSourceDescriptor{
diff --git a/config/configLoader.go b/config/configLoader.go
index 656ef7f7e..dd103f27b 100644
--- a/config/configLoader.go
+++ b/