aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2024-01-28 22:34:10 +0100
committerBjørn Erik Pedersen <[email protected]>2024-01-28 23:14:09 +0100
commita795acbcd8b18aa4af384d5c03f30740361c8fcf (patch)
tree0dbf7b000681a738b892c5235daf52c63cda88b9
parent982d9513e71b3d48e20cfa38454a0e1215a8d963 (diff)
downloadhugo-a795acbcd8b18aa4af384d5c03f30740361c8fcf.tar.gz
hugo-a795acbcd8b18aa4af384d5c03f30740361c8fcf.zip
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/config/configLoader.go
@@ -208,7 +208,6 @@ func LoadConfigFromDir(sourceFs afero.Fs, configDir, environment string) (Provid
}
return cfg, dirnames, nil
-
}
var keyAliases maps.KeyRenamer
diff --git a/config/defaultConfigProvider.go b/config/defaultConfigProvider.go
index e8a08e281..f840c6cb0 100644
--- a/config/defaultConfigProvider.go
+++ b/config/defaultConfigProvider.go
@@ -370,7 +370,6 @@ func (c *defaultConfigProvider) SetDefaultMergeStrategy() {
}
return false
})
-
}
func (c *defaultConfigProvider) getNestedKeyAndMap(key string, create bool) (string, maps.Params) {
diff --git a/config/env.go b/config/env.go
index 0ad5ecaea..4dcd63653 100644
--- a/config/env.go
+++ b/config/env.go
@@ -49,7 +49,6 @@ func GetMemoryLimit() uint64 {
if v := stringToGibabyte(mem); v > 0 {
return v
}
-
}
// There is a FreeMemory function, but as the kernel in most situations
diff --git a/config/security/whitelist_test.go b/config/security/whitelist_test.go
index 89d1bc2b1..add3345a8 100644
--- a/config/security/whitelist_test.go
+++ b/config/security/whitelist_test.go
@@ -43,5 +43,4 @@ func TestWhitelist(t *testing.T) {
c.Assert(w.Accept("bar"), qt.IsTrue)
c.Assert(w.Accept("mbar"), qt.IsFalse)
})
-
}
diff --git a/deploy/deployConfig.go b/deploy/deployConfig.go
index 3cd5dc3a8..f9454b3e4 100644
--- a/deploy/deployConfig.go
+++ b/deploy/deployConfig.go
@@ -14,11 +14,10 @@
package deploy
import (
+ "errors"
"fmt"
"regexp"
- "errors"
-
"github.com/gobwas/glob"
"github.com/gohugoio/hugo/config"
hglob "github.com/gohugoio/hugo/hugofs/glob"
@@ -132,7 +131,6 @@ var DefaultConfig = DeployConfig{
// DecodeConfig creates a config from a given Hugo configuration.
func DecodeConfig(cfg config.Provider) (DeployConfig, error) {
-
dcfg := DefaultConfig
if !cfg.IsSet(deploymentConfigKey) {
diff --git a/htesting/test_helpers_test.go b/htesting/test_helpers_test.go
index 3e767ac9d..bec81cccf 100644
--- a/htesting/test_helpers_test.go
+++ b/htesting/test_helpers_test.go
@@ -20,12 +20,10 @@ import (
)
func TestExtractMinorVersionFromGoTag(t *testing.T) {
-
c := qt.New(t)
c.Assert(extractMinorVersionFromGoTag("go1.17"), qt.Equals, 17)
c.Assert(extractMinorVersionFromGoTag("go1.16.7"), qt.Equals, 16)
c.Assert(extractMinorVersionFromGoTag("go1.17beta1"), qt.Equals, 17)
c.Assert(extractMinorVersionFromGoTag("asdfadf"), qt.Equals, -1)
-
}
diff --git a/hugofs/createcounting_fs.go b/hugofs/createcounting_fs.go
index 1737ad5ce..901deb3ae 100644
--- a/hugofs/createcounting_fs.go
+++ b/hugofs/createcounting_fs.go
@@ -33,9 +33,7 @@ type DuplicatesReporter interface {
ReportDuplicates() string
}
-var (
- _ FilesystemUnwrapper = (*createCountingFs)(nil)
-)
+var _ FilesystemUnwrapper = (*createCountingFs)(nil)
func NewCreateCountingFs(fs afero.Fs) afero.Fs {
return &createCountingFs{Fs: fs, fileCount: make(map[string]int)}
diff --git a/hugofs/glob/glob_test.go b/hugofs/glob/glob_test.go
index 454fb850a..b63854e29 100644
--- a/hugofs/glob/glob_test.go
+++ b/hugofs/glob/glob_test.go
@@ -75,7 +75,6 @@ func TestGetGlob(t *testing.T) {
}
func BenchmarkGetGlob(b *testing.B) {
-
runBench := func(name string, cache *globCache, search string) {
b.Run(name, func(b *testing.B) {
g, err := GetGlob("**/foo")
diff --git a/hugolib/404_test.go b/hugolib/404_test.go
index 3c6a06045..fef020905 100644
--- a/hugolib/404_test.go
+++ b/hugolib/404_test.go
@@ -41,8 +41,8 @@ Data: {{ len .Data }}|
IntegrationTestConfig{
T: t,
TxtarString: files,
- //LogLevel: logg.LevelTrace,
- //Verbose: true,
+ // LogLevel: logg.LevelTrace,
+ // Verbose: true,
},
).Build()
diff --git a/hugolib/config.go b/hugolib/config.go
index 70dd790fe..13167dafd 100644
--- a/hugolib/config.go
+++ b/hugolib/config.go
@@ -157,7 +157,7 @@ module github.com/bep/mymod
tempDir := os.TempDir()
cacheDir := filepath.Join(tempDir, "hugocache")
- if err := os.MkdirAll(cacheDir, 0777); err != nil {
+ if err := os.MkdirAll(cacheDir, 0o777); err != nil {
return nil, err
}
cfg.Set("cacheDir", cacheDir)
@@ -168,11 +168,11 @@ module github.com/bep/mymod
fs := afero.NewOsFs()
- if err := afero.WriteFile(fs, filepath.Join(tempDir, "hugo.toml"), []byte(configToml), 0644); err != nil {
+ if err := afero.WriteFile(fs, filepath.Join(tempDir, "hugo.toml"), []byte(configToml), 0o644); err != nil {
return nil, err
}
- if err := afero.WriteFile(fs, filepath.Join(tempDir, "go.mod"), []byte(goMod), 0644); err != nil {
+ if err := afero.WriteFile(fs, filepath.Join(tempDir, "go.mod"), []byte(goMod), 0o644); err != nil {
return nil, err
}
@@ -181,5 +181,4 @@ module github.com/bep/mymod
return nil, err
}
return conf.Base, err
-
}
diff --git a/hugolib/language_test.go b/hugolib/language_test.go
index 74f80a29d..c9368770e 100644
--- a/hugolib/language_test.go
+++ b/hugolib/language_test.go
@@ -26,7 +26,7 @@ import (
func TestI18n(t *testing.T) {
c := qt.New(t)
- //https://github.com/gohugoio/hugo/issues/7804
+ // https://github.com/gohugoio/hugo/issues/7804
c.Run("pt-br should be case insensitive", func(c *qt.C) {
b := newTestSitesBuilder(c)
langCode := func() string {
@@ -76,12 +76,10 @@ name = "foo-a"
menus := b.H.Sites[0].Menus()
c.Assert(menus, qt.HasLen, 1)
-
})
}
func TestLanguageNumberFormatting(t *testing.T) {
-
b := newTestSitesBuilder(t)
b.WithConfigFile("toml", `
baseURL = "https://example.org"
diff --git a/langs/language_test.go b/langs/language_test.go
index e2c734567..543f4a133 100644
--- a/langs/language_test.go
+++ b/langs/language_test.go
@@ -23,7 +23,6 @@ import (
)
func TestCollator(t *testing.T) {
-
c := qt.New(t)
var wg sync.WaitGroup
@@ -43,7 +42,6 @@ func TestCollator(t *testing.T) {
}()
}
wg.Wait()
-
}
func BenchmarkCollator(b *testing.B) {
@@ -75,5 +73,4 @@ func BenchmarkCollator(b *testing.B) {
}
})
})
-
}
diff --git a/lazy/init_test.go b/lazy/init_test.go
index efc329d79..96a959494 100644
--- a/lazy/init_test.go
+++ b/lazy/init_test.go
@@ -234,5 +234,4 @@ func TestResetError(t *testing.T) {
r = true
_, err = i.Do(context.Background())
c.Assert(err, qt.IsNil)
-
}
diff --git a/markup/goldmark/images/transform.go b/markup/goldmark/images/transform.go
index 4eb793ae1..2e97a6791 100644
--- a/markup/goldmark/images/transform.go
+++ b/markup/goldmark/images/transform.go
@@ -71,7 +71,5 @@ func (t *Transformer) Transform(doc *ast.Document, reader text.Reader, pctx pars
}
return ast.WalkContinue, nil
-
})
-
}
diff --git a/markup/goldmark/internal/extensions/attributes/attributes.go b/markup/goldmark/internal/extensions/attributes/attributes.go
index 60ae609ec..feb3d915b 100644
--- a/markup/goldmark/internal/extensions/attributes/attributes.go
+++ b/markup/goldmark/internal/extensions/attributes/attributes.go
@@ -56,7 +56,7 @@ func (a *attrParser) Continue(node ast.Node, reader text.Reader, pc parser.Conte
func (a *attrParser) Open(parent ast.Node, reader text.Reader, pc parser.Context) (ast.Node, parser.State) {
if attrs, ok := parser.ParseAttributes(reader); ok {
// add attributes
- var node = &attributesBlock{
+ node := &attributesBlock{
BaseBlock: ast.BaseBlock{},
}
for _, attr := range attrs {
@@ -95,7 +95,7 @@ func (a *attributesBlock) Kind() ast.NodeKind {
type transformer struct{}
func (a *transformer) Transform(node *ast.Document, reader text.Reader, pc parser.Context) {
- var attributes = make([]ast.Node, 0, 500)
+ attributes := make([]ast.Node, 0, 500)
ast.Walk(node, func(node ast.Node, entering bool) (ast.WalkStatus, error) {
if entering && node.Kind() == kindAttributesBlock {
// Attributes for fenced code blocks are handled in their own extension,
diff --git a/markup/internal/external.go b/markup/internal/external.go
index 97cf5cc7d..dc8cc61c2 100644
--- a/markup/internal/external.go
+++ b/markup/internal/external.go
@@ -13,7 +13,8 @@ import (
func ExternallyRenderContent(
cfg converter.ProviderConfig,
ctx converter.DocumentContext,
- content []byte, binaryName string, args []string) ([]byte, error) {
+ content []byte, binaryName string, args []string,
+) ([]byte, error) {
logger := cfg.Logger
if strings.Contains(binaryName, "/") {
diff --git a/markup/markup_config/config_test.go b/markup/markup_config/config_test.go
index 782cedbc9..5169bd79f 100644
--- a/markup/markup_config/config_test.go
+++ b/markup/markup_config/config_test.go
@@ -83,7 +83,5 @@ func TestConfig(t *testing.T) {
c.Assert(err, qt.IsNil)
c.Assert(conf.Goldmark.Extensions.Typographer.Disable, qt.Equals, false)
c.Assert(conf.Goldmark.Extensions.Typographer.Ellipsis, qt.Equals, "&hellip;")
-
})
-
}
diff --git a/markup/pandoc/convert.go b/markup/pandoc/convert.go
index eaa9bfb6a..8f2d99c9a 100644
--- a/markup/pandoc/convert.go
+++ b/markup/pandoc/convert.go
@@ -26,8 +26,7 @@ import (
// Provider is the package entry point.
var Provider converter.ProviderProvider = provider{}
-type provider struct {
-}
+type provider struct{}
func (p provider) New(cfg converter.ProviderConfig) (converter.Provider, error) {
return converter.NewProvider("pandoc", func(ctx converter.DocumentContext) (converter.Converter, error) {
diff --git a/markup/rst/convert.go b/markup/rst/convert.go
index b7aa5a2ce..398f5eb0c 100644
--- a/markup/rst/convert.go
+++ b/markup/rst/convert.go
@@ -30,8 +30,7 @@ import (
// Provider is the package entry point.
var Provider converter.ProviderProvider = provider{}
-type provider struct {
-}
+type provider struct{}
func (p provider) New(cfg converter.ProviderConfig) (converter.Provider, error) {
return converter.NewProvider("rst", func(ctx converter.DocumentContext) (converter.Converter, error) {
diff --git a/markup/tableofcontents/tableofcontents_test.go b/markup/tableofcontents/tableofcontents_test.go
index ac9ad0eed..3af9c4eb6 100644
--- a/markup/tableofcontents/tableofcontents_test.go
+++ b/markup/tableofcontents/tableofcontents_test.go
@@ -186,7 +186,6 @@ func TestTocMisc(t *testing.T) {
}
func BenchmarkToc(b *testing.B) {
-
newTocs := func(n int) []*Fragments {
var tocs []*Fragments
for i := 0; i < n; i++ {
@@ -216,5 +215,4 @@ func BenchmarkToc(b *testing.B) {
toc.ToHTML(1, -1, false)
}
})
-
}
diff --git a/media/builtin.go b/media/builtin.go
index 64b5163b8..aafe245c9 100644
--- a/media/builtin.go
+++ b/media/builtin.go
@@ -51,58 +51,56 @@ type BuiltinTypes struct {
OctetType Type
}
-var (
- Builtin = BuiltinTypes{
- CalendarType: Type{Type: "text/calendar"},
- CSSType: Type{Type: "text/css"},
- SCSSType: Type{Type: "text/x-scss"},
- SASSType: Type{Type: "text/x-sass"},
- CSVType: Type{Type: "text/csv"},
- HTMLType: Type{Type: "text/html"},
- JavascriptType: Type{Type: "text/javascript"},
- TypeScriptType: Type{Type: "text/typescript"},
- TSXType: Type{Type: "text/tsx"},
- JSXType: Type{Type: "text/jsx"},
-
- JSONType: Type{Type: "application/json"},
- WebAppManifestType: Type{Type: "application/manifest+json"},
- RSSType: Type{Type: "application/rss+xml"},
- XMLType: Type{Type: "application/xml"},
- SVGType: Type{Type: "image/svg+xml"},
- TextType: Type{Type: "text/plain"},
- TOMLType: Type{Type: "application/toml"},
- YAMLType: Type{Type: "application/yaml"},
-
- // Common image types
- PNGType: Type{Type: "image/png"},
- JPEGType: Type{Type: "image/jpeg"},
- GIFType: Type{Type: "image/gif"},
- TIFFType: Type{Type: "image/tiff"},
- BMPType: Type{Type: "image/bmp"},
- WEBPType: Type{Type: "image/webp"},
-
- // Common font types
- TrueTypeFontType: Type{Type: "font/ttf"},
- OpenTypeFontType: Type{Type: "font/otf"},
-
- // Common document types
- PDFType: Type{Type: "application/pdf"},
- MarkdownType: Type{Type: "text/markdown"},
-
- // Common video types
- AVIType: Type{Type: "video/x-msvideo"},
- MPEGType: Type{Type: "video/mpeg"},
- MP4Type: Type{Type: "video/mp4"},
- OGGType: Type{Type: "video/ogg"},
- WEBMType: Type{Type: "video/webm"},
- GPPType: Type{Type: "video/3gpp"},
-
- // Web assembly.
- WasmType: Type{Type: "application/wasm"},
-
- OctetType: Type{Type: "application/octet-stream"},
- }
-)
+var Builtin = BuiltinTypes{
+ CalendarType: Type{Type: "text/calendar"},
+ CSSType: Type{Type: "text/css"},
+ SCSSType: Type{Type: "text/x-scss"},
+ SASSType: Type{Type: "text/x-sass"},
+ CSVType: Type{Type: "text/csv"},
+ HTMLType: Type{Type: "text/html"},
+ JavascriptType: Type{Type: "text/javascript"},
+ TypeScriptType: Type{Type: "text/typescript"},
+ TSXType: Type{Type: "text/tsx"},
+ JSXType: Type{Type: "text/jsx"},
+
+ JSONType: Type{Type: "application/json"},
+ WebAppManifestType: Type{Type: "application/manifest+json"},
+ RSSType: Type{Type: "application/rss+xml"},
+ XMLType: Type{Type: "application/xml"},
+ SVGType: Type{Type: "image/svg+xml"},
+ TextType: Type{Type: "text/plain"},
+ TOMLType: Type{Type: "application/toml"},
+ YAMLType: Type{Type: "application/yaml"},
+
+ // Common image types
+ PNGType: Type{Type: "image/png"},
+ JPEGType: Type{Type: "image/jpeg"},
+ GIFType: Type{Type: "image/gif"},
+ TIFFType: Type{Type: "image/tiff"},
+ BMPType: Type{Type: "image/bmp"},
+ WEBPType: Type{Type: "image/webp"},
+
+ // Common font types
+ TrueTypeFontType: Type{Type: "font/ttf"},
+ OpenTypeFontType: Type{Type: "font/otf"},
+
+ // Common document types
+ PDFType: Type{Type: "application/pdf"},
+ MarkdownType: Type{Type: "text/markdown"},
+
+ // Common video types
+ AVIType: Type{Type: "video/x-msvideo"},
+ MPEGType: Type{Type: "video/mpeg"},
+ MP4Type: Type{Type: "video/mp4"},
+ OGGType: Type{Type: "video/ogg"},
+ WEBMType: Type{Type: "video/webm"},
+ GPPType: Type{Type: "video/3gpp"},
+
+ // Web assembly.
+ WasmType: Type{Type: "application/wasm"},
+
+ OctetType: Type{Type: "application/octet-stream"},
+}
var defaultMediaTypesConfig = map[string]any{
"text/calendar": map[string]any{"suffixes": []string{"ics"}},
diff --git a/minifiers/minifiers_test.go b/minifiers/minifiers_test.go
index af1b5d996..bfd743fae 100644
--- a/minifiers/minifiers_test.go
+++ b/minifiers/minifiers_test.go
@@ -184,7 +184,6 @@ func TestDecodeConfigDecimalIsNowPrecision(t *testing.T) {
conf := testconfig.GetTestConfigs(nil, v).Base.Minify
c.Assert(conf.Tdewolff.CSS.Precision, qt.Equals, 3)
-
}
// Issue 9456
@@ -209,7 +208,7 @@ func TestDecodeConfigKeepWhitespace(t *testing.T) {
KeepDocumentTags: true,
KeepEndTags: false,
KeepQuotes: false,
- KeepWhitespace: false},
+ KeepWhitespace: false,
+ },
)
-
}
diff --git a/modules/client.go b/modules/client.go
index fae6a4c0a..26117fbcf 100644
--- a/modules/client.go
+++ b/modules/client.go
@@ -18,6 +18,7 @@ import (
"bytes"
"context"
"encoding/json"
+ "errors"
"fmt"
"io"
"os"
@@ -46,8 +47,6 @@ import (
"github.com/gohugoio/hugo/common/hugio"
- "errors"
-
"github.com/spf13/afero"
)
@@ -199,7 +198,7 @@ func (c *Client) Vendor() error {
if err := c.rmVendorDir(vendorDir); err != nil {
return err
}
- if err := c.fs.MkdirAll(vendorDir, 0755); err != nil {
+ if err := c.fs.MkdirAll(vendorDir, 0o755); err != nil {
return err
}
@@ -260,7 +259,7 @@ func (c *Client) Vendor() error {
} else {
targetDir := filepath.Dir(targetFilename)
- if err := c.fs.MkdirAll(targetDir, 0755); err != nil {
+ if err := c.fs.MkdirAll(targetDir, 0o755); err != nil {
return fmt.Errorf("failed to make target dir: %w", err)
}
@@ -303,7 +302,7 @@ func (c *Client) Vendor() error {
}
if modulesContent.Len() > 0 {
- if err := afero.WriteFile(c.fs, filepath.Join(vendorDir, vendorModulesFilename), modulesContent.Bytes(), 0666); err != nil {
+ if err := afero.WriteFile(c.fs, filepath.Join(vendorDir, vendorModulesFilename), modulesContent.Bytes(), 0o666); err != nil {
return err
}
}
@@ -558,7 +557,7 @@ func (c *Client) rewriteGoMod(name string, isGoMod map[string]bool) error {
return err
}
if data != nil {
- if err := afero.WriteFile(c.fs, filepath.Join(c.ccfg.WorkingDir, name), data, 0666); err != nil {
+ if err := afero.WriteFile(c.fs, filepath.Join(c.ccfg.WorkingDir, name), data, 0o666); err != nil {
return err
}
}
@@ -636,7 +635,8 @@ func (c *Client) rmVendorDir(vendorDir string) error {
func (c *Client) runGo(
ctx context.Context,
stdout io.Writer,
- args ...string) error {
+ args ...string,
+) error {
if c.goBinaryStatus != 0 {
return nil
}
diff --git a/modules/config_test.go b/modules/config_test.go
index 5c97caaa2..6dac14e9a 100644
--- a/modules/config_test.go
+++ b/modules/config_test.go
@@ -100,7 +100,6 @@ lang="en"
c.Assert(imp.Mounts[1].Source, qt.Equals, "src/markdown/blog")
c.Assert(imp.Mounts[1].Target, qt.Equals, "content/blog")
c.Assert(imp.Mounts[1].Lang, qt.Equals, "en")
-
})
c.Run("Replacements", func(c *qt.C) {
diff --git a/modules/module.go b/modules/module.go
index da963de58..8c7316eea 100644
--- a/modules/module.go
+++ b/modules/module.go
@@ -25,7 +25,6 @@ import (
var _ Module = (*moduleAdapter)(nil)
type Module interface {
-
// Optional config read from the configFilename above.
Cfg() config.Provider
@@ -157,7 +156,6 @@ func (m *moduleAdapter) Time() time.Time {
}
return *m.gomod.Time
-
}
func (m *moduleAdapter) Watch() bool {
diff --git a/navigation/pagemenus.go b/navigation/pagemenus.go
index ab57231c3..3ff49cf81 100644
--- a/navigation/pagemenus.go
+++ b/navigation/pagemenus.go
@@ -78,7 +78,7 @@ func PageMenusFromPage(p Page) (PageMenus, error) {
return pm, nil
}
- var wrapErr = func(err error) error {
+ wrapErr := func(err error) error {
return fmt.Errorf("unable to process menus for page %q: %w", p.Path(), err)
}
@@ -109,7 +109,8 @@ func PageMenusFromPage(p Page) (PageMenus, error) {
func NewMenuQueryProvider(
pagem PageMenusGetter,
sitem MenusGetter,
- p Page) MenuQueryProvider {
+ p Page,
+) MenuQueryProvider {
return &pageMenus{
p: p,
pagem: pagem,
diff --git a/output/docshelper.go b/output/docshelper.go
index ee299420c..f7f3b0c4a 100644
--- a/output/docshelper.go
+++ b/output/docshelper.go
@@ -41,7 +41,6 @@ func createLayoutExamples() any {
name string
d layouts.LayoutDescriptor
}{
-
// Taxonomy layouts.LayoutDescriptor={categories category taxonomy en false Type Section
{"Single page in \"posts\" section", layouts.LayoutDescriptor{Kind: "page", Type: "posts", OutputFormatName: "html", Suffix: "html"}},
{"Base template for single page in \"posts\" section", layouts.LayoutDescriptor{Baseof: true, Kind: "page", Type: "posts", OutputFormatName: "html", Suffix: "html"}},
diff --git a/output/layouts/layout_test.go b/output/layouts/layout_test.go
index 2f340f238..b6033247c 100644
--- a/output/layouts/layout_test.go
+++ b/output/layouts/layout_test.go
@@ -953,7 +953,6 @@ func TestLayout(t *testing.T) {
}
})
}
-
}
/*
diff --git a/output/outputFormat_test.go b/output/outputFormat_test.go
index 13e24af3b..c86bcd634 100644
--- a/output/outputFormat_test.go
+++ b/output/outputFormat_test.go
@@ -69,7 +69,6 @@ func TestDefaultTypes(t *testing.T) {
c.Assert(CalendarFormat.IsHTML, qt.Equals, false)
c.Assert(len(DefaultFormats), qt.Equals, 11)
-
}
func TestGetFormatByName(t *testing.T) {
diff --git a/parser/metadecoders/decoder_test.go b/parser/metadecoders/decoder_test.go
index 48def7d12..734713c2e 100644
--- a/parser/metadecoders/decoder_test.go
+++ b/parser/metadecoders/decoder_test.go
@@ -56,23 +56,26 @@ func TestUnmarshalXML(t *testing.T) {
"guid": "https://example.com/2021/11/30/example-title/",
"link": "https://example.com/2021/11/30/example-title/",
"pubDate": "Tue, 30 Nov 2021 15:00:00 +0000",
- "title": "Example title"},
+ "title": "Example title",
+ },
"language": "en-us",
"lastBuildDate": "Fri, 08 Jan 2021 14:44:10 +0000",
"link": []any{"https://example.com/", map[string]any{
"-href": "https://example.com/feed.xml",
"-rel": "self",
- "-type": "application/rss+xml"}},
+ "-type": "application/rss+xml",
+ }},
"title": "Example feed",
- }}
+ },
+ }
d := Default
m, err := d.Unmarshal([]byte(xmlDoc), XML)
c.Assert(err, qt.IsNil)
c.Assert(m, qt.DeepEquals, expect)
-
}
+
func TestUnmarshalToMap(t *testing.T) {
c := qt.New(t)
diff --git a/parser/pageparser/item_test.go b/parser/pageparser/item_test.go
index 72bb69103..36b95e93a 100644
--- a/parser/pageparser/item_test.go
+++ b/parser/pageparser/item_test.go
@@ -46,5 +46,4 @@ func TestItemValTyped(t *testing.T) {
c.Assert(Item{low: 0, high: len(source)}.ValTyped(source), qt.Equals, "truex")
source = []byte("xtrue")
c.Assert(Item{low: 0, high: len(source)}.ValTyped(source), qt.Equals, "xtrue")
-
}
diff --git a/parser/pageparser/pagelexer_shortcode.go b/parser/pageparser/pagelexer_shortcode.go
index 5b4e0ae55..def2f82c7 100644
--- a/parser/pageparser/pagelexer_shortcode.go
+++ b/parser/pageparser/pagelexer_shortcode.go
@@ -22,7 +22,6 @@ type lexerShortcodeState struct {
elementStepNum int // step number in element
paramElements int // number of elements (name + value = 2) found first
openShortcodes map[string]bool // set of shortcodes in open state
-
}
// Shortcode syntax
diff --git a/publisher/htmlElementsCollector.go b/publisher/htmlElementsCollector.go
index 6c01fd8d9..11a640550 100644
--- a/publisher/htmlElementsCollector.go
+++ b/publisher/htmlElementsCollector.go
@@ -466,7 +466,6 @@ func parseStartTag(s string) string {
}
return s
-
}
// isClosedByTag reports whether b ends with a closing tag for tagName.
@@ -523,7 +522,6 @@ LOOP:
}
return bytes.EqualFold(tagName, b[lo:hi])
-
}
func isSpace(b byte) bool {
diff --git a/publisher/htmlElementsCollector_test.go b/publisher/htmlElementsCollector_test.go
index 3cd834acb..36447258e 100644
--- a/publisher/htmlElementsCollector_test.go
+++ b/publisher/htmlElementsCollector_test.go
@@ -86,7 +86,8 @@ func TestClassCollector(t *testing.T) {
}">
</div>
</body>`, f("body div", "class1 class2 class3", "")},
- {"AlpineJS bind 2", `<div x-bind:class="{ 'bg-black': filter.checked }" class="inline-block mr-1 mb-2 rounded bg-gray-300 px-2 py-2">FOO</div>`,
+ {
+ "AlpineJS bind 2", `<div x-bind:class="{ 'bg-black': filter.checked }" class="inline-block mr-1 mb-2 rounded bg-gray-300 px-2 py-2">FOO</div>`,
f("div", "bg-black bg-gray-300 inline-block mb-2 mr-1 px-2 py-2 rounded", ""),
},
{"AlpineJS bind 3", `<div x-bind:class="{ 'text-gray-800': !checked, 'text-white': checked }"></div>`, f("div", "text-gray-800 text-white", "")},
@@ -130,7 +131,6 @@ func TestClassCollector(t *testing.T) {
<div id="b" class="foo">d</div>`, f("div form", "foo", "a b")},
{"Big input, multibyte runes", strings.Repeat(`神真美好 `, rnd.Intn(500)+1) + "<div id=\"神真美好\" class=\"foo\">" + strings.Repeat(`神真美好 `, rnd.Intn(100)+1) + " <span>神真美好</span>", f("div span", "foo", "神真美好")},
} {
-
for _, variant := range []struct {
minify bool
}{
@@ -161,7 +161,6 @@ func TestClassCollector(t *testing.T) {
})
}
}
-
}
func TestEndsWithTag(t *testing.T) {
@@ -190,7 +189,6 @@ func TestEndsWithTag(t *testing.T) {
c.Assert(got, qt.Equals, test.expect)
})
}
-
}
func BenchmarkElementsCollectorWriter(b *testing.B) {
@@ -276,6 +274,5 @@ func BenchmarkElementsCollectorWriterPre(b *testing.B) {
))
for i := 0; i < b.N; i++ {
fmt.Fprint(w, benchHTML)
-
}
}
diff --git a/related/inverted_index_test.go b/related/inverted_index_test.go
index 72b2f3252..f1d8e11a1 100644
--- a/related/inverted_index_test.go
+++ b/related/inverted_index_test.go
@@ -118,7 +118,6 @@ func TestCardinalityThreshold(t *testing.T) {
c.Assert(hasKeyword("tags", "b"), qt.Equals, false)
c.Assert(hasKeyword("tags", "d"), qt.Equals, true)
c.Assert(hasKeyword("keywords", "b"), qt.Equals, true)
-
}
func TestSearch(t *testing.T) {
diff --git a/resources/images/color.go b/resources/images/color.go
index fe891fe88..71872a30e 100644
--- a/resources/images/color.go
+++ b/resources/images/color.go
@@ -50,7 +50,6 @@ func ColorToHexString(c color.Color) string {
r, g, b, a := c.RGBA()
rgba := color.RGBA{uint8(r), uint8(g), uint8(b), uint8(a)}
return fmt.Sprintf("#%.2x%.2x%.2x", rgba.R, rgba.G, rgba.B)
-
}
func hexStringToColor(s string) (color.Color, error) {
diff --git a/resources/page/page_matcher_test.go b/resources/page/page_matcher_test.go
index 2108d51c2..c27a2e9b2 100644
--- a/resources/page/page_matcher_test.go
+++ b/resources/page/page_matcher_test.go
@@ -28,8 +28,7 @@ func TestPageMatcher(t *testing.T) {
developmentTestSite := testSite{h: hugo.NewInfo(testConfig{environment: "development"}, nil)}
productionTestSite := testSite{h: hugo.NewInfo(testConfig{environment: "production"}, nil)}
- p1, p2, p3 :=
- &testPage{path: "/p1", kind: "section", lang: "en", site: developmentTestSite},
+ p1, p2, p3 := &testPage{path: "/p1", kind: "section", lang: "en", site: developmentTestSite},
&testPage{path: "p2", kind: "page", lang: "no", site: productionTestSite},
&testPage{path: "p3", kind: "page", lang: "en"}
@@ -154,7 +153,6 @@ func TestDecodeCascadeConfig(t *testing.T) {
got, err = DecodeCascadeConfig(nil)
c.Assert(err, qt.IsNil)
c.Assert(got, qt.IsNotNil)
-
}
type testConfig struct {
diff --git a/resources/resource_factories/create/remote_test.go b/resources/resource_factories/create/remote_test.go
index a443a0633..21314ad34 100644
--- a/resources/resource_factories/create/remote_test.go
+++ b/resources/resource_factories/create/remote_test.go
@@ -81,7 +81,6 @@ func TestDecodeRemoteOptions(t *testing.T) {
c.Assert(err, isErr)
c.Assert(got, qt.DeepEquals, test.want)
})
-
}
}
@@ -114,7 +113,6 @@ func TestOptionsNewRequest(t *testing.T) {
c.Assert(err, qt.IsNil)
c.Assert(req.Method, qt.Equals, "GET")
c.Assert(req.Header["User-Agent"], qt.DeepEquals, []string{"foo"})
-
}
func TestCalculateResourceID(t *testing.T) {
diff --git a/resources/resource_transformers/tocss/dartsass/dartsass_integration_test.go b/resources/resource_transformers/tocss/dartsass/dartsass_integration_test.go
index c370a1cc8..dd4c1e5ca 100644
--- a/resources/resource_transformers/tocss/dartsass/dartsass_integration_test.go
+++ b/resources/resource_transformers/tocss/dartsass/dartsass_integration_test.go
@@ -293,7 +293,6 @@ T1: {{ $r.Content }}
b.AssertLogMatches(`Dart Sass: foo`)
b.AssertLogMatches(`Dart Sass: .*assets.*main.scss:1:0: bar`)
-
}
func TestTransformErrors(t *testing.T) {
@@ -347,7 +346,6 @@ T1: {{ $r.Content }}
b.Assert(fe.ErrorContext(), qt.IsNotNil)
b.Assert(fe.ErrorContext().Lines, qt.DeepEquals, []string{" $maincolor #eee;", "", "body {", "\tcolor: $maincolor;", "}"})
b.Assert(fe.ErrorContext().ChromaLexer, qt.Equals, "scss")
-
})
c.Run("error in import", func(c *qt.C) {
@@ -365,9 +363,7 @@ T1: {{ $r.Content }}
b.Assert(fe.ErrorContext(), qt.IsNotNil)
b.Assert(fe.ErrorContext().Lines, qt.DeepEquals, []string{"/* comment line 1 */", "$foocolor #ccc;", "", "foo {"})
b.Assert(fe.ErrorContext().ChromaLexer, qt.Equals, "scss")
-
})
-
}
func TestOptionVars(t *testing.T) {
@@ -528,5 +524,4 @@ T1: {{ $r.Content }}
b.AssertLogMatches(`Dart Sass: .*assets.*main.scss:12:0: number`)
b.AssertLogMatches(`Dart Sass: .*assets.*main.scss:13:0: number`)
b.AssertLogMatches(`Dart Sass: .*assets.*main.scss:14:0: number`)
-
}
diff --git a/resources/resource_transformers/tocss/scss/client_extended.go b/resources/resource_transformers/tocss/scss/client_extended.go
index bfee39499..c9b347c4c 100644
--- a/resources/resource_transformers/tocss/scss/client_extended.go
+++ b/resources/resource_transformers/tocss/scss/client_extended.go
@@ -47,7 +47,6 @@ func (c *Client) ToCSS(res resources.ResourceTransformer, opts Options) (resourc
}
return res.Transform(&toCSSTransformation{c: c, options: internalOptions})
-
}
type toCSSTransformation struct {
diff --git a/resources/resource_transformers/tocss/scss/scss_integration_test.go b/resources/resource_transformers/tocss/scss/scss_integration_test.go
index d0dd65e20..4d7d9d710 100644
--- a/resources/resource_transformers/tocss/scss/scss_integration_test.go
+++ b/resources/resource_transformers/tocss/scss/scss_integration_test.go
@@ -228,7 +228,6 @@ T1: {{ $r.Content }}
b.Assert(fe.ErrorContext(), qt.IsNotNil)
b.Assert(fe.ErrorContext().Lines, qt.DeepEquals, []string{"/* comment line 4 */", "", "$maincolor #eee;", "", "body {"})
b.Assert(fe.ErrorContext().ChromaLexer, qt.Equals, "scss")
-
})
c.Run("error in import", func(c *qt.C) {
@@ -245,9 +244,7 @@ T1: {{ $r.Content }}
b.Assert(fe.ErrorContext(), qt.IsNotNil)
b.Assert(fe.ErrorContext().Lines, qt.DeepEquals, []string{"/* comment line 1 */", "$foocolor #ccc;", "", "foo {"})
b.Assert(fe.ErrorContext().ChromaLexer, qt.Equals, "scss")
-
})
-
}
func TestOptionVars(t *testing.T) {
diff --git a/tpl/cast/cast.go b/tpl/cast/cast.go
index 535697f9e..1999ddc0a 100644
--- a/tpl/cast/cast.go
+++ b/tpl/cast/cast.go
@@ -26,8 +26,7 @@ func New() *Namespace {
}
// Namespace provides template functions for the "cast" namespace.
-type Namespace struct {
-}
+type Namespace struct{}
// ToInt converts v to an int.
func (ns *Namespace) ToInt(v any) (int, error) {
diff --git a/tpl/collections/merge.go b/tpl/collections/merge.go
index c6aa50eba..8c019e412 100644
--- a/tpl/collections/merge.go
+++ b/tpl/collections/merge.go
@@ -14,14 +14,13 @@
package collections
import (
+ "errors"
"fmt"
"reflect"
"strings"
"github.com/gohugoio/hugo/common/hreflect"
"github.com/gohugoio/hugo/common/maps"
-
- "errors"
)
// Merge creates a copy of the final parameter in params and merges the preceding
diff --git a/tpl/collections/reflect_helpers.go b/tpl/collections/reflect_helpers.go
index a295441ec..56909d30e 100644
--- a/tpl/collections/reflect_helpers.go
+++ b/tpl/collections/reflect_helpers.go
@@ -14,11 +14,10 @@
package collections
import (
+ "errors"
"fmt"
"reflect"
- "errors"
-
"github.com/mitchellh/hashstructure"
)
diff --git a/tpl/collections/where_test.go b/tpl/collections/where_test.go
index 08d8963c5..7ec9572e0 100644
--- a/tpl/collections/where_test.go
+++ b/tpl/collections/where_test.go
@@ -876,7 +876,7 @@ func BenchmarkWhereOps(b *testing.B) {
j := rand.Intn(i + 1)
seq[i], seq[j] = seq[j], seq[i]
}
- //results, err = ns.Where(context.Background(), test.seq, test.key, test.op, test.match)
+ // results, err = ns.Where(context.Background(), test.seq, test.key, test.op, test.match)
runOps := func(b *testing.B, op, match string) {
_, err := ns.Where(ctx, seq, "foo", op, match)
if err != nil {
@@ -901,5 +901,4 @@ func BenchmarkWhereOps(b *testing.B) {
runOps(b, "like", "^bar")
}
})
-
}
diff --git a/tpl/crypto/crypto.go b/tpl/crypto/crypto.go
index c721d401b..412a19212 100644
--- a/tpl/crypto/crypto.go
+++ b/tpl/crypto/crypto.go
@@ -118,7 +118,7 @@ func (ns *Namespace) HMAC(h any, k any, m any, e ...any) (string, error) {
return "", err
}
- var encoding = "hex"
+ encoding := "hex"
if len(e) > 0 && e[0] != nil {
encoding, err = cast.ToStringE(e[0])
if err != nil {
@@ -134,5 +134,4 @@ func (ns *Namespace) HMAC(h any, k any, m any, e ...any) (string, error) {
default:
return "", fmt.Errorf("%q is not a supported encoding method", encoding)
}
-
}
diff --git a/tpl/css/css.go b/tpl/css/css.go
index 5fc613011..51fa1d518 100644
--- a/tpl/css/css.go
+++ b/tpl/css/css.go
@@ -12,8 +12,7 @@ import (
const name = "css"
// Namespace provides template functions for the "css" namespace.
-type Namespace struct {
-}
+type Namespace struct{}
// Quoted returns a string that needs to be quoted in CSS.
func (ns *Namespace) Quoted(v any) css.QuotedString {
diff --git a/tpl/data/data_test.go b/tpl/data/data_test.go
index c51dbbd82..7c49d8076 100644
--- a/tpl/data/data_test.go
+++ b/tpl/data/data_test.go
@@ -72,7 +72,6 @@ func TestGetCSV(t *testing.T) {
false,
},
} {
-
c.Run(test.url, func(c *qt.C) {
msg := qt.Commentf("Test %d", i)
@@ -119,7 +118,6 @@ func TestGetCSV(t *testing.T) {
c.Assert(got, qt.Not(qt.IsNil), msg)
c.Assert(got, qt.DeepEquals, test.expect, msg)
})
-
}
}
@@ -164,9 +162,7 @@ func TestGetJSON(t *testing.T) {
map[string]any{"gomeetup": []any{"Sydney", "San Francisco", "Stockholm"}},
},
} {
-
c.Run(test.url, func(c *qt.C) {
-
msg := qt.Commentf("Test %d", i)
ns := newTestNs()
@@ -208,7 +204,6 @@ func TestGetJSON(t *testing.T) {
c.Assert(int(ns.deps.Log.LoggCount(logg.LevelError)), qt.Equals, 0, msg)
c.Assert(got, qt.Not(qt.IsNil), msg)
c.Assert(got, qt.DeepEquals, test.expect)
-
})
}
}
@@ -263,9 +258,7 @@ func TestHeaders(t *testing.T) {
},
},
} {
-
c.Run(test.name, func(c *qt.C) {
-
ns := newTestNs()
// Setup HTTP test server
@@ -275,7 +268,6 @@ func TestHeaders(t *testing.T) {
c.Assert(r.URL.String(), qt.Equals, "http://gohugo.io/api?foo")
w.Write([]byte("{}"))
r.Header.Write(&headers)
-
})
defer func() { srv.Close() }()
@@ -296,9 +288,7 @@ func TestHeaders(t *testing.T) {
_, err := ns.GetCSV(",", args...)
return err
})
-
})
-
}
}
diff --git a/tpl/images/images.go b/tpl/images/images.go
index 82510aaa3..02ffb333f 100644
--- a/tpl/images/images.go
+++ b/tpl/images/images.go
@@ -15,11 +15,10 @@
package images
import (
+ "errors"
"image"
"sync"
- "errors"
-
"github.com/bep/overlayfs"
"github.com/gohugoio/hugo/resources/images"
diff --git a/tpl/images/images_test.go b/tpl/images/images_test.go
index 1b70b7c70..4f656d1f9 100644
--- a/tpl/images/images_test.go
+++ b/tpl/images/images_test.go
@@ -101,7 +101,7 @@ func TestNSConfig(t *testing.T) {
// cast path to string for afero.WriteFile
sp, err := cast.ToStringE(test.path)
c.Assert(err, qt.IsNil)
- afero.WriteFile(ns.deps.Fs.Source, filepath.Join(bcfg.WorkingDir(), sp), test.input, 0755)
+ afero.WriteFile(ns.deps.Fs.Source, filepath.Join(bcfg.WorkingDir(), sp), test.input, 0o755)
result, err := ns.Config(test.path)
diff --git a/tpl/internal/templatefuncRegistry_test.go b/tpl/internal/templatefuncRegistry_test.go
index 8609bf34a..5d837f961 100644
--- a/tpl/internal/templatefuncRegistry_test.go
+++ b/tpl/internal/templatefuncRegistry_test.go
@@ -20,8 +20,7 @@ import (
qt "github.com/frankban/quicktest"
)
-type Test struct {
-}
+type Test struct{}
func (t *Test) MyTestMethod() string {
return "abcde"
diff --git a/tpl/math/math.go b/tpl/math/math.go
index 0f8db11e2..3368f6b73 100644
--- a/tpl/math/math.go
+++ b/tpl/math/math.go
@@ -215,7 +215,6 @@ func (ns *Namespace) applyOpToScalarsOrSlices(opName string, op func(x, y float6
return
}
return
-
}
func (ns *Namespace) toFloatsE(v any) ([]float64, bool, error) {
diff --git a/tpl/path/path.go b/tpl/path/path.go
index 59add2152..3ae89c699 100644
--- a/tpl/path/path.go
+++ b/tpl/path/path.go
@@ -154,7 +154,6 @@ func (ns *Namespace) Join(elements ...any) (string, error) {
// extraneous slashes are removed.
func (ns *Namespace) Clean(path any) (string, error) {
spath, err := cast.ToStringE(path)
-
if err != nil {
return "", err
}
diff --git a/tpl/strings/regexp.go b/tpl/strings/regexp.go
index df323c216..cf0306556 100644
--- a/tpl/strings/regexp.go
+++ b/tpl/strings/regexp.go
@@ -70,7 +70,6 @@ func (ns *Namespace) FindRESubmatch(expr string, content any, limit ...any) ([][
}
return re.FindAllStringSubmatch(conv, n), nil
-
}
// ReplaceRE returns a copy of s, replacing all matches of the regular
diff --git a/tpl/strings/regexp_test.go b/tpl/strings/regexp_test.go
index b6ec5cb9e..f0735fbc2 100644
--- a/tpl/strings/regexp_test.go
+++ b/tpl/strings/regexp_test.go
@@ -83,6 +83,7 @@ func TestFindRESubmatch(t *testing.T) {
c.Check(result, qt.DeepEquals, test.expect)
}
}
+
func TestReplaceRE(t *testing.T) {
t.Parallel()
c := qt.New(t)
diff --git a/tpl/strings/truncate_test.go b/tpl/strings/truncate_test.go
index e2339aa27..d307d786d 100644
--- a/tpl/strings/truncate_test.go
+++ b/tpl/strings/truncate_test.go
@@ -111,5 +111,4 @@ func BenchmarkTruncate(b *testing.B) {
ns.Truncate(10, "I have a <a href='/markdown'>Markdown link</a> inside")
}
})
-
}
diff --git a/tpl/time/time_test.go b/tpl/time/time_test.go
index 9001f6b6b..b13e62929 100644
--- a/tpl/time/time_test.go
+++ b/tpl/time/time_test.go
@@ -124,7 +124,7 @@ func TestFormat(t *testing.T) {
}
})
- //Issue #9084
+ // Issue #9084
c.Run("TZ America/Los_Angeles", func(c *qt.C) {
c.Parallel()
@@ -136,9 +136,7 @@ func TestFormat(t *testing.T) {
c.Assert(err, qt.IsNil)
c.Assert(d, qt.Equals, "11:00:00 am Pacific Daylight Time")
-
})
-
}
func TestDuration(t *testing.T) {
diff --git a/tpl/tplimpl/shortcodes.go b/tpl/tplimpl/shortcodes.go
index 938fc74e2..a1e7b463e 100644
--- a/tpl/tplimpl/shortcodes.go
+++ b/tpl/tplimpl/shortcodes.go
@@ -23,7 +23,6 @@ import (
const numTemplateVariants = 3
type shortcodeVariant struct {
-
// The possible variants: lang, outFormat, suffix
// gtag
// gtag.html
diff --git a/tpl/transform/remarshal.go b/tpl/transform/remarshal.go
index 0ad54bb96..2fbdacd2d 100644
--- a/tpl/transform/remarshal.go
+++ b/tpl/transform/remarshal.go
@@ -2,9 +2,8 @@ package transform
import (
"bytes"
- "strings"
-
"errors"
+ "strings"
"github.com/gohugoio/hugo/parser"
"github.com/gohugoio/hugo/parser/metadecoders"
diff --git a/tpl/urls/urls.go b/tpl/urls/urls.go
index b06b562a7..6c4681a0c 100644
--- a/tpl/urls/urls.go
+++ b/tpl/urls/urls.go
@@ -189,7 +189,6 @@ func (ns *Namespace) AbsLangURL(s any) (string, error) {
// of any ./ or ../ elements. If the argument list is empty, JoinPath returns
// an empty string.
func (ns *Namespace) JoinPath(elements ...any) (string, error) {
-
if len(elements) == 0 {
return "", nil
}
diff --git a/watcher/filenotify/poller.go b/watcher/filenotify/poller.go
index 3bde73bd8..cedb5d079 100644
--- a/watcher/filenotify/poller.go
+++ b/watcher/filenotify/poller.go
@@ -248,7 +248,6 @@ func newItemToWatch(filename string) (*itemToWatch, error) {
}
return &itemToWatch{filename: filename, left: r}, nil
-
}
func (item *itemToWatch) checkForChanges() ([]fsnotify.Event, error) {
@@ -298,7 +297,6 @@ func (item *itemToWatch) checkForChanges() ([]fsnotify.Event, error) {
}
return evs, nil
-
}
func checkChange(fi1, fi2 os.FileInfo) fsnotify.Op {