index {
return pages[index], nil
@@ -207,7 +206,6 @@ func splitPages(pages Pages, size int) []paginatedElement {
}
func splitPageGroups(pageGroups PagesGroup, size int) []paginatedElement {
-
type keyPage struct {
key interface{}
page Page
@@ -269,7 +267,6 @@ func ResolvePagerSize(cfg config.Provider, options ...interface{}) (int, error)
}
func Paginate(td TargetPathDescriptor, seq interface{}, pagerSize int) (*Paginator, error) {
-
if pagerSize <= 0 {
return nil, errors.New("'paginate' configuration setting must be positive to paginate")
}
@@ -300,7 +297,6 @@ func Paginate(td TargetPathDescriptor, seq interface{}, pagerSize int) (*Paginat
// The motivation behind this is to avoid potential costly reflect.DeepEqual
// when "probably" is good enough.
func probablyEqualPageLists(a1 interface{}, a2 interface{}) bool {
-
if a1 == nil || a2 == nil {
return a1 == a2
}
@@ -347,7 +343,6 @@ func probablyEqualPageLists(a1 interface{}, a2 interface{}) bool {
}
func newPaginatorFromPages(pages Pages, size int, urlFactory paginationURLFactory) (*Paginator, error) {
-
if size <= 0 {
return nil, errors.New("Paginator size must be positive")
}
@@ -358,7 +353,6 @@ func newPaginatorFromPages(pages Pages, size int, urlFactory paginationURLFactor
}
func newPaginatorFromPageGroups(pageGroups PagesGroup, size int, urlFactory paginationURLFactory) (*Paginator, error) {
-
if size <= 0 {
return nil, errors.New("Paginator size must be positive")
}
@@ -389,7 +383,6 @@ func newPaginator(elements []paginatedElement, total, size int, urlFactory pagin
}
func newPaginationURLFactory(d TargetPathDescriptor) paginationURLFactory {
-
return func(pageNumber int) string {
pathDescriptor := d
var rel string
@@ -399,6 +392,5 @@ func newPaginationURLFactory(d TargetPathDescriptor) paginationURLFactory {
}
return CreateTargetPaths(pathDescriptor).RelPermalink(d.PathSpec)
-
}
}
diff --git a/resources/page/pagination_test.go b/resources/page/pagination_test.go
index f4441a892..8d4f857d7 100644
--- a/resources/page/pagination_test.go
+++ b/resources/page/pagination_test.go
@@ -37,7 +37,6 @@ func TestSplitPages(t *testing.T) {
lastChunk := chunks[4]
c.Assert(lastChunk.Len(), qt.Equals, 1)
-
}
func TestSplitPageGroups(t *testing.T) {
@@ -78,7 +77,6 @@ func TestSplitPageGroups(t *testing.T) {
} else {
t.Fatal("Excepted PageGroup")
}
-
}
func TestPager(t *testing.T) {
@@ -111,7 +109,6 @@ func TestPager(t *testing.T) {
first = pag.Pagers()[0].First()
c.Assert(first.PageGroups(), qt.Not(qt.HasLen), 0)
c.Assert(first.Pages(), qt.HasLen, 0)
-
}
func doTestPages(t *testing.T, paginator *Paginator) {
@@ -171,7 +168,6 @@ func TestPagerNoPages(t *testing.T) {
first = paginator.Pagers()[0].First()
c.Assert(first.PageGroups(), qt.HasLen, 0)
c.Assert(first.Pages(), qt.HasLen, 0)
-
}
func doTestPagerNoPages(t *testing.T, paginator *Paginator) {
@@ -195,7 +191,6 @@ func doTestPagerNoPages(t *testing.T, paginator *Paginator) {
c.Assert(pageOne.TotalPages(), qt.Equals, 0)
c.Assert(pageOne.PageNumber(), qt.Equals, 1)
c.Assert(pageOne.PageSize(), qt.Equals, 5)
-
}
func TestPaginationURLFactory(t *testing.T) {
@@ -206,7 +201,6 @@ func TestPaginationURLFactory(t *testing.T) {
for _, uglyURLs := range []bool{false, true} {
c.Run(fmt.Sprintf("uglyURLs=%t", uglyURLs), func(c *qt.C) {
-
tests := []struct {
name string
d TargetPathDescriptor
@@ -215,10 +209,16 @@ func TestPaginationURLFactory(t *testing.T) {
expected string
expectedUgly string
}{
- {"HTML home page 32",
- TargetPathDescriptor{Kind: KindHome, Type: output.HTMLFormat}, "http://example.com/", 32, "/zoo/32/", "/zoo/32.html"},
- {"JSON home page 42",
- TargetPathDescriptor{Kind: KindHome, Type: output.JSONFormat}, "http://example.com/", 42, "/zoo/42/index.json", "/zoo/42.json"},
+ {
+ "HTML home page 32",
+ TargetPathDescriptor{Kind: KindHome, Type: output.HTMLFormat},
+ "http://example.com/", 32, "/zoo/32/", "/zoo/32.html",
+ },
+ {
+ "JSON home page 42",
+ TargetPathDescriptor{Kind: KindHome, Type: output.JSONFormat},
+ "http://example.com/", 42, "/zoo/42/index.json", "/zoo/42.json",
+ },
}
for _, test := range tests {
@@ -242,7 +242,6 @@ func TestPaginationURLFactory(t *testing.T) {
}
})
-
}
}
@@ -276,7 +275,6 @@ func TestProbablyEqualPageLists(t *testing.T) {
if result != this.expect {
t.Errorf("[%d] got %t but expected %t", i, result, this.expect)
-
}
}
}
diff --git a/resources/page/permalinks.go b/resources/page/permalinks.go
index 0e9b9e212..19ac52172 100644
--- a/resources/page/permalinks.go
+++ b/resources/page/permalinks.go
@@ -60,7 +60,6 @@ func (p PermalinkExpander) callback(attr string) (pageToPermaAttribute, bool) {
// NewPermalinkExpander creates a new PermalinkExpander configured by the given
// PathSpec.
func NewPermalinkExpander(ps *helpers.PathSpec) (PermalinkExpander, error) {
-
p := PermalinkExpander{ps: ps}
p.knownPermalinkAttributes = map[string]pageToPermaAttribute{
@@ -103,11 +102,9 @@ func (l PermalinkExpander) Expand(key string, p Page) (string, error) {
}
return expand(p)
-
}
func (l PermalinkExpander) parse(patterns map[string]string) (map[string]func(Page) (string, error), error) {
-
expanders := make(map[string]func(Page) (string, error))
// Allow " " and / to represent the root section.
@@ -138,7 +135,6 @@ func (l PermalinkExpander) parse(patterns map[string]string) (map[string]func(Pa
}
expanders[k] = func(p Page) (string, error) {
-
if matches == nil {
return pattern, nil
}
@@ -149,7 +145,6 @@ func (l PermalinkExpander) parse(patterns map[string]string) (map[string]func(Pa
attr := replacement[1:]
callback := callbacks[i]
newAttr, err := callback(p, attr)
-
if err != nil {
return "", &permalinkExpandError{pattern: pattern, err: err}
}
@@ -159,7 +154,6 @@ func (l PermalinkExpander) parse(patterns map[string]string) (map[string]func(Pa
}
return newField, nil
-
}
}
@@ -176,7 +170,7 @@ var attributeRegexp = regexp.MustCompile(`:\w+`)
// validate determines if a PathPattern is well-formed
func (l PermalinkExpander) validate(pp string) bool {
fragments := strings.Split(pp[1:], "/")
- var bail = false
+ bail := false
for i := range fragments {
if bail {
return false
diff --git a/resources/page/permalinks_test.go b/resources/page/permalinks_test.go
index e4eeda748..e40e7e0ef 100644
--- a/resources/page/permalinks_test.go
+++ b/resources/page/permalinks_test.go
@@ -113,7 +113,6 @@ func TestPermalinkExpansionMultiSection(t *testing.T) {
expanded, err = expander.Expand("blog", page)
c.Assert(err, qt.IsNil)
c.Assert(expanded, qt.Equals, "/blue/2012")
-
}
func TestPermalinkExpansionConcurrent(t *testing.T) {
diff --git a/resources/page/testhelpers_test.go b/resources/page/testhelpers_test.go
index 54a908d3b..963848439 100644
--- a/resources/page/testhelpers_test.go
+++ b/resources/page/testhelpers_test.go
@@ -128,8 +128,8 @@ func (p *testPage) AlternativeOutputFormats() OutputFormats {
func (p *testPage) Author() Author {
return Author{}
-
}
+
func (p *testPage) Authors() AuthorList {
return nil
}
@@ -165,6 +165,7 @@ func (p *testPage) Sitemap() config.Sitemap {
func (p *testPage) Layout() string {
return ""
}
+
func (p *testPage) Date() time.Time {
return p.date
}
diff --git a/resources/page/weighted.go b/resources/page/weighted.go
index 7e5e25451..af8b54446 100644
--- a/resources/page/weighted.go
+++ b/resources/page/weighted.go
@@ -20,9 +20,7 @@ import (
"github.com/gohugoio/hugo/common/collections"
)
-var (
- _ collections.Slicer = WeightedPage{}
-)
+var _ collections.Slicer = WeightedPage{}
// WeightedPages is a list of Pages with their corresponding (and relative) weight
// [{Weight: 30, Page: *1}, {Weight: 40, Page: *2}]
diff --git a/resources/page/zero_file.autogen.go b/resources/page/zero_file.autogen.go
index 23e36b764..f928982e0 100644
--- a/resources/page/zero_file.autogen.go
+++ b/resources/page/zero_file.autogen.go
@@ -38,50 +38,62 @@ func (z zeroFile) Path() (o0 string) {
z.log.Println(".File.Path on zero object. Wrap it in if or with: {{ with .File }}{{ .Path }}{{ end }}")
return
}
+
func (z zeroFile) Section() (o0 string) {
z.log.Println(".File.Section on zero object. Wrap it in if or with: {{ with .File }}{{ .Section }}{{ end }}")
return
}
+
func (z zeroFile) Lang() (o0 string) {
z.log.Println(".File.Lang on zero object. Wrap it in if or with: {{ with .File }}{{ .Lang }}{{ end }}")
return
}
+
func (z zeroFile) Filename() (o0 string) {
z.log.Println(".File.Filename on zero object. Wrap it in if or with: {{ with .File }}{{ .Filename }}{{ end }}")
return
}
+
func (z zeroFile) Dir() (o0 string) {
z.log.Println(".File.Dir on zero object. Wrap it in if or with: {{ with .File }}{{ .Dir }}{{ end }}")
return
}
+
func (z zeroFile) Extension() (o0 string) {
z.log.Println(".File.Extension on zero object. Wrap it in if or with: {{ with .File }}{{ .Extension }}{{ end }}")
return
}
+
func (z zeroFile) Ext() (o0 string) {
z.log.Println(".File.Ext on zero object. Wrap it in if or with: {{ with .File }}{{ .Ext }}{{ end }}")
return
}
+
func (z zeroFile) LogicalName() (o0 string) {
z.log.Println(".File.LogicalName on zero object. Wrap it in if or with: {{ with .File }}{{ .LogicalName }}{{ end }}")
return
}
+
func (z zeroFile) BaseFileName() (o0 string) {
z.log.Println(".File.BaseFileName on zero object. Wrap it in if or with: {{ with .File }}{{ .BaseFileName }}{{ end }}")
return
}
+
func (z zeroFile) TranslationBaseName() (o0 string) {
z.log.Println(".File.TranslationBaseName on zero object. Wrap it in if or with: {{ with .File }}{{ .TranslationBaseName }}{{ end }}")
return
}
+
func (z zeroFile) ContentBaseName() (o0 string) {
z.log.Println(".File.ContentBaseName on zero object. Wrap it in if or with: {{ with .File }}{{ .ContentBaseName }}{{ end }}")
return
}
+
func (z zeroFile) UniqueID() (o0 string) {
z.log.Println(".File.UniqueID on zero object. Wrap it in if or with: {{ with .File }}{{ .UniqueID }}{{ end }}")
return
}
+
func (z zeroFile) FileInfo() (o0 hugofs.FileMetaInfo) {
z.log.Println(".File.FileInfo on zero object. Wrap it in if or with: {{ with .File }}{{ .FileInfo }}{{ end }}")
return
diff --git a/resources/postpub/fields.go b/resources/postpub/fields.go
index f1cfe6092..ed3491438 100644
--- a/resources/postpub/fields.go
+++ b/resources/postpub/fields.go
@@ -53,7 +53,7 @@ func structToMap(s interface{}) map[string]interface{} {
// insert placeholder for the templates. Do it very shallow for now.
func insertFieldPlaceholders(root string, m map[string]interface{}, createPlaceholder func(s string) string) {
- for k, _ := range m {
+ for k := range m {
m[k] = createPlaceholder(root + "." + k)
}
}
diff --git a/resources/postpub/fields_test.go b/resources/postpub/fields_test.go
index d67c7c9a9..10a68ac5a 100644
--- a/resources/postpub/fields_test.go
+++ b/resources/postpub/fields_test.go
@@ -42,5 +42,4 @@ func TestCreatePlaceholders(t *testing.T) {
"SubType": "pre_foo.SubType_post",
"Suffixes": "pre_foo.Suffixes_post",
})
-
}
diff --git a/resources/postpub/postpub.go b/resources/postpub/postpub.go
index 3a1dd2f85..85b4221fd 100644
--- a/resources/postpub/postpub.go
+++ b/resources/postpub/postpub.go
@@ -108,7 +108,6 @@ func (r *PostPublishResource) GetFieldString(pattern string) (string, bool) {
default:
panic(fmt.Sprintf("unknown field accessor %q", fieldAccessor))
}
-
}
func (r *PostPublishResource) fieldToString(receiver interface{}, path string) string {
diff --git a/resources/resource.go b/resources/resource.go
index acdf2d744..64f9f12f3 100644
--- a/resources/resource.go
+++ b/resources/resource.go
@@ -276,7 +276,6 @@ func (l *genericResource) Publish() error {
defer fw.Close()
_, err = io.Copy(fw, fr)
-
})
return err
@@ -435,7 +434,6 @@ func (l genericResource) clone() *genericResource {
// returns an opened file or nil if nothing to write (it may already be published).
func (l *genericResource) openDestinationsForWriting() (w io.WriteCloser, err error) {
-
l.publishInit.Do(func() {
targetFilenames := l.getTargetFilenames()
var changedFilenames []string
@@ -456,11 +454,9 @@ func (l *genericResource) openDestinationsForWriting() (w io.WriteCloser, err er
}
w, err = helpers.OpenFilesForWriting(l.getSpec().BaseFs.PublishFs, changedFilenames...)
-
})
return
-
}
func (r *genericResource) openPublishFileForWriting(relTargetPath string) (io.WriteCloser, error) {
diff --git a/resources/resource/params.go b/resources/resource/params.go
index 89da718ec..c76eedeab 100644
--- a/resources/resource/params.go
+++ b/resources/resource/params.go
@@ -30,5 +30,4 @@ func Param(r ResourceParamsProvider, fallback maps.Params, key interface{}) (int
}
return maps.GetNestedParam(keyStr, ".", r.Params(), fallback)
-
}
diff --git a/resources/resource_cache.go b/resources/resource_cache.go
index 6c4ba951b..f498bb0c0 100644
--- a/resources/resource_cache.go
+++ b/resources/resource_cache.go
@@ -69,8 +69,8 @@ func resourceKeyPartition(filename string) string {
// Commonly used aliases and directory names used for some types.
var extAliasKeywords = map[string][]string{
- "sass": []string{"scss"},
- "scss": []string{"sass"},
+ "sass": {"scss"},
+ "scss": {"sass"},
}
// ResourceKeyPartitions resolves a ordered slice of partitions that is
@@ -201,7 +201,6 @@ func (c *ResourceCache) getOrCreate(key string, f func() (interface{}, error)) (
c.set(key, r)
return r, nil
-
}
func (c *ResourceCache) getFilenames(key string) (string, string) {
@@ -230,7 +229,6 @@ func (c *ResourceCache) getFromFile(key string) (filecache.ItemInfo, io.ReadClos
fi, rc, _ := c.fileCache.Get(filenameContent)
return fi, rc, meta, rc != nil
-
}
// writeMeta writes the metadata to file and returns a writer for the content part.
@@ -254,7 +252,6 @@ func (c *ResourceCache) writeMeta(key string, meta transformedResourceMetadata)
fi, fc, err := c.fileCache.WriteCloser(filenameContent)
return fi, fc, err
-
}
func (c *ResourceCache) set(key string, r interface{}) {
@@ -294,7 +291,6 @@ func (c *ResourceCache) DeletePartitions(partitions ...string) {
delete(c.cache, k)
}
}
-
}
func (c *ResourceCache) DeleteMatches(re *regexp.Regexp) {
@@ -305,7 +301,5 @@ func (c *ResourceCache) DeleteMatches(re *regexp.Regexp) {
if re.MatchString(k) {
delete(c.cache, k)
}
-
}
-
}
diff --git a/resources/resource_factories/bundler/bundler.go b/resources/resource_factories/bundler/bundler.go
index 1ea92bea3..7de228227 100644
--- a/resources/resource_factories/bundler/bundler.go
+++ b/resources/resource_factories/bundler/bundler.go
@@ -130,7 +130,6 @@ func (c *Client) Concat(targetPath string, r resource.Resources) (resource.Resou
}
return newMultiReadSeekCloser(rcsources...), nil
-
}
composite, err := c.rs.New(
@@ -138,13 +137,12 @@ func (c *Client) Concat(targetPath string, r resource.Resources) (resource.Resou
Fs: c.rs.FileCaches.AssetsCache().Fs,
LazyPublish: true,
OpenReadSeekCloser: concatr,
- RelTargetFilename: filepath.Clean(targetPath)})
-
+ RelTargetFilename: filepath.Clean(targetPath),
+ })
if err != nil {
return nil, err
}
return composite, nil
})
-
}
diff --git a/resources/resource_factories/bundler/bundler_test.go b/resources/resource_factories/bundler/bundler_test.go
index 16a5215ba..17a74cc88 100644
--- a/resources/resource_factories/bundler/bundler_test.go
+++ b/resources/resource_factories/bundler/bundler_test.go
@@ -37,5 +37,4 @@ func TestMultiReadSeekCloser(t *testing.T) {
_, err := rc.Seek(0, 0)
c.Assert(err, qt.IsNil)
}
-
}
diff --git a/resources/resource_factories/create/create.go b/resources/resource_factories/create/create.go
index 4ac20d36e..1bba98d21 100644
--- a/resources/resource_factories/create/create.go
+++ b/resources/resource_factories/create/create.go
@@ -47,9 +47,9 @@ func (c *Client) Get(filename string) (resource.Resource, error) {
return c.rs.New(resources.ResourceSourceDescriptor{
Fs: c.rs.BaseFs.Assets.Fs,
LazyPublish: true,
- SourceFilename: filename})
+ SourceFilename: filename,
+ })
})
-
}
// Match gets the resources matching the given pattern from the assets filesystem.
@@ -93,8 +93,8 @@ func (c *Client) match(pattern string, firstOnly bool) (resource.Resources, erro
OpenReadSeekCloser: func() (hugio.ReadSeekCloser, error) {
return meta.Open()
},
- RelTargetFilename: meta.Path()})
-
+ RelTargetFilename: meta.Path(),
+ })
if err != nil {
return true, err
}
@@ -102,7 +102,6 @@ func (c *Client) match(pattern string, firstOnly bool) (resource.Resources, erro
res = append(res, r)
return firstOnly, nil
-
}
if err := hugofs.Glob(c.rs.BaseFs.Assets.Fs, pattern, handle); err != nil {
@@ -110,7 +109,6 @@ func (c *Client) match(pattern string, firstOnly bool) (resource.Resources, erro
}
return res, nil
-
})
}
@@ -124,8 +122,7 @@ func (c *Client) FromString(targetPath, content string) (resource.Resource, erro
OpenReadSeekCloser: func() (hugio.ReadSeekCloser, error) {
return hugio.NewReadSeekerNoOpCloserFromString(content), nil
},
- RelTargetFilename: filepath.Clean(targetPath)})
-
+ RelTargetFilename: filepath.Clean(targetPath),
+ })
})
-
}
diff --git a/resources/resource_metadata.go b/resources/resource_metadata.go
index 7bf7479a3..a0c232c67 100644
--- a/resources/resource_metadata.go
+++ b/resources/resource_metadata.go
@@ -16,6 +16,7 @@ package resources
import (
"fmt"
"strconv"
+ "strings"
"github.com/gohugoio/hugo/hugofs/glob"
"github.com/gohugoio/hugo/media"
@@ -24,8 +25,6 @@ import (
"github.com/pkg/errors"
"github.com/spf13/cast"
- "strings"
-
"github.com/gohugoio/hugo/common/maps"
)
diff --git a/resources/resource_metadata_test.go b/resources/resource_metadata_test.go
index c79a50021..87a537f74 100644
--- a/resources/resource_metadata_test.go
+++ b/resources/resource_metadata_test.go
@@ -43,7 +43,6 @@ func TestAssignMetadata(t *testing.T) {
c.Assert(logo1.Title(), qt.Equals, "My Resource")
c.Assert(logo1.Name(), qt.Equals, "My Name")
c.Assert(foo2.Name(), qt.Equals, "My Name")
-
}},
{[]map[string]interface{}{
{
@@ -62,7 +61,6 @@ func TestAssignMetadata(t *testing.T) {
c.Assert(foo2.Name(), qt.Equals, "My Name")
c.Assert(foo3.Name(), qt.Equals, "My Name")
c.Assert(foo3.Title(), qt.Equals, "My Resource")
-
}},
{[]map[string]interface{}{
{
@@ -102,7 +100,6 @@ func TestAssignMetadata(t *testing.T) {
c.Assert(icon1, qt.Equals, "logo")
c.Assert(icon2, qt.Equals, "resource")
-
}},
{[]map[string]interface{}{
{
@@ -126,7 +123,6 @@ func TestAssignMetadata(t *testing.T) {
c.Assert(foo3.Title(), qt.Equals, "Resource #5")
c.Assert(resources.GetMatch("logo name #1*"), qt.Equals, logo2)
-
}},
{[]map[string]interface{}{
{
@@ -146,7 +142,6 @@ func TestAssignMetadata(t *testing.T) {
c.Assert(logo2.Name(), qt.Equals, "Name #1")
c.Assert(logo1.Title(), qt.Equals, "Other Logo #2")
c.Assert(logo1.Name(), qt.Equals, "Name #2")
-
}},
{[]map[string]interface{}{
{
@@ -166,7 +161,6 @@ func TestAssignMetadata(t *testing.T) {
c.Assert(logo2.Name(), qt.Equals, "Name #1")
c.Assert(logo1.Title(), qt.Equals, "Other Logo #2")
c.Assert(logo1.Name(), qt.Equals, "Name #2")
-
}},
{[]map[string]interface{}{
{
@@ -186,7 +180,6 @@ func TestAssignMetadata(t *testing.T) {
c.Assert(logo2.Name(), qt.Equals, "Name #1")
c.Assert(logo1.Title(), qt.Equals, "Logo #2")
c.Assert(logo1.Name(), qt.Equals, "Name #2")
-
}},
{[]map[string]interface{}{
{
@@ -195,7 +188,6 @@ func TestAssignMetadata(t *testing.T) {
}, func(err error) {
// Missing src
c.Assert(err, qt.Not(qt.IsNil))
-
}},
{[]map[string]interface{}{
{
@@ -205,7 +197,6 @@ func TestAssignMetadata(t *testing.T) {
}, func(err error) {
// Invalid pattern
c.Assert(err, qt.Not(qt.IsNil))
-
}},
} {
@@ -227,5 +218,4 @@ func TestAssignMetadata(t *testing.T) {
this.assertFunc(AssignMetadata(this.metaData, resources...))
}
-
}
diff --git a/resources/resource_spec.go b/resources/resource_spec.go
index 0ca60fe31..1659332ab 100644
--- a/resources/resource_spec.go
+++ b/resources/resource_spec.go
@@ -53,7 +53,6 @@ func NewSpec(
errorHandler herrors.ErrorSender,
outputFormats output.Formats,
mimeTypes media.Types) (*Spec, error) {
-
imgConfig, err := images.DecodeConfig(s.Cfg.GetStringMap("imaging"))
if err != nil {
return nil, err
@@ -96,12 +95,12 @@ func NewSpec(
fileCaches.ImageCache(),
s,
- )}
+ ),
+ }
rs.ResourceCache = newResourceCache(rs)
return rs, nil
-
}
type Spec struct {
@@ -189,7 +188,6 @@ func (r *Spec) newGenericResource(sourceFs afero.Fs,
baseFilename,
mediaType,
)
-
}
func (r *Spec) newGenericResourceWithBase(
@@ -201,7 +199,6 @@ func (r *Spec) newGenericResourceWithBase(
sourceFilename,
baseFilename string,
mediaType media.Type) *genericResource {
-
if osFileInfo != nil && osFileInfo.IsDir() {
panic(fmt.Sprintf("dirs not supported resource types: %v", osFileInfo))
}
@@ -250,7 +247,6 @@ func (r *Spec) newGenericResourceWithBase(
}
return g
-
}
func (r *Spec) newResource(sourceFs afero.Fs, fd ResourceSourceDescriptor) (resource.Resource, error) {
@@ -318,7 +314,6 @@ func (r *Spec) newResource(sourceFs afero.Fs, fd ResourceSourceDescriptor) (reso
}
return newResourceAdapter(gr.spec, fd.LazyPublish, gr), nil
-
}
func (r *Spec) newResourceFor(fd ResourceSourceDescriptor) (resource.Resource, error) {
diff --git a/resources/resource_test.go b/resources/resource_test.go
index 7a0b8069d..bf7a94529 100644
--- a/resources/resource_test.go
+++ b/resources/resource_test.go
@@ -39,7 +39,6 @@ func TestGenericResource(t *testing.T) {
c.Assert(r.Permalink(), qt.Equals, "https://example.com/foo.css")
c.Assert(r.RelPermalink(), qt.Equals, "/foo.css")
c.Assert(r.ResourceType(), qt.Equals, "css")
-
}
func TestGenericResourceWithLinkFacory(t *testing.T) {
@@ -78,7 +77,6 @@ func TestNewResourceFromFilename(t *testing.T) {
c.Assert(err, qt.IsNil)
c.Assert(r, qt.Not(qt.IsNil))
c.Assert(r.ResourceType(), qt.Equals, "json")
-
}
func TestNewResourceFromFilenameSubPathInBaseURL(t *testing.T) {
@@ -96,7 +94,6 @@ func TestNewResourceFromFilenameSubPathInBaseURL(t *testing.T) {
c.Assert(r.ResourceType(), qt.Equals, "image")
c.Assert(r.RelPermalink(), qt.Equals, "/docs/a/b/logo.png")
c.Assert(r.Permalink(), qt.Equals, "https://example.com/docs/a/b/logo.png")
-
}
var pngType, _ = media.FromStringAndExt("image/png", "png")
@@ -108,11 +105,11 @@ func TestResourcesByType(t *testing.T) {
spec.newGenericResource(nil, nil, nil, "/a/foo1.css", "foo1.css", media.CSSType),
spec.newGenericResource(nil, nil, nil, "/a/logo.png", "logo.css", pngType),
spec.newGenericResource(nil, nil, nil, "/a/foo2.css", "foo2.css", media.CSSType),
- spec.newGenericResource(nil, nil, nil, "/a/foo3.css", "foo3.css", media.CSSType)}
+ spec.newGenericResource(nil, nil, nil, "/a/foo3.css", "foo3.css", media.CSSType),
+ }
c.Assert(len(resources.ByType("css")), qt.Equals, 3)
c.Assert(len(resources.ByType("image")), qt.Equals, 1)
-
}
func TestResourcesGetByPrefix(t *testing.T) {
@@ -123,7 +120,8 @@ func TestResourcesGetByPrefix(t *testing.T) {
spec.newGenericResource(nil, nil, nil, "/a/logo1.png", "logo1.png", pngType),
spec.newGenericResource(nil, nil, nil, "/b/Logo2.png", "Logo2.png", pngType),
spec.newGenericResource(nil, nil, nil, "/b/foo2.css", "foo2.css", media.CSSType),
- spec.newGenericResource(nil, nil, nil, "/b/foo3.css", "foo3.css", media.CSSType)}
+ spec.newGenericResource(nil, nil, nil, "/b/foo3.css", "foo3.css", media.CSSType),
+ }
c.Assert(resources.GetMatch("asdf*"), qt.IsNil)
c.Assert(resources.GetMatch("logo*").RelPermalink(), qt.Equals, "/logo1.png")
@@ -141,7 +139,6 @@ func TestResourcesGetByPrefix(t *testing.T) {
c.Assert(logo.Params(), qt.Not(qt.IsNil))
c.Assert(logo.Name(), qt.Equals, "logo1.png")
c.Assert(logo.Title(), qt.Equals, "logo1.png")
-
}
func TestResourcesGetMatch(t *testing.T) {
@@ -187,7 +184,6 @@ func TestResourcesGetMatch(t *testing.T) {
// (it is possible for users to do a rename)
// This is analogous to standing in a directory and doing "ls *.*".
c.Assert(len(resources.Match("/c/**.css")), qt.Equals, 0)
-
}
func BenchmarkResourcesMatch(b *testing.B) {
@@ -218,7 +214,6 @@ func BenchmarkResourcesMatchA100(b *testing.B) {
for i := 0; i < b.N; i++ {
resources.Match(pattern)
}
-
}
func benchResources(b *testing.B) resource.Resources {
@@ -242,7 +237,6 @@ func benchResources(b *testing.B) resource.Resources {
}
return resources
-
}
func BenchmarkAssignMetadata(b *testing.B) {
@@ -252,7 +246,7 @@ func BenchmarkAssignMetadata(b *testing.B) {
for i := 0; i < b.N; i++ {
b.StopTimer()
var resources resource.Resources
- var meta = []map[string]interface{}{
+ meta := []map[string]interface{}{
{
"title": "Foo #:counter",
"name": "Foo Name #:counter",
diff --git a/resources/resource_transformers/babel/babel.go b/resources/resource_transformers/babel/babel.go
index a9d39d31b..a7598f820 100644
--- a/resources/resource_transformers/babel/babel.go
+++ b/resources/resource_transformers/babel/babel.go
@@ -51,6 +51,7 @@ func DecodeOptions(m map[string]interface{}) (opts Options, err error) {
err = mapstructure.WeakDecode(m, &opts)
return
}
+
func (opts Options) toArgs() []string {
var args []string
@@ -111,7 +112,6 @@ func (t *babelTransformation) Transform(ctx *resources.ResourceTransformationCtx
// Try PATH
binary = binaryName
if _, err := exec.LookPath(binary); err != nil {
-
// This may be on a CI server etc. Will fall back to pre-built assets.
return herrors.ErrFeatureNotAvailable
}
diff --git a/resources/resource_transformers/integrity/integrity.go b/resources/resource_transformers/integrity/integrity.go
index 1b74de7eb..bbd0b6675 100644
--- a/resources/resource_transformers/integrity/integrity.go
+++ b/resources/resource_transformers/integrity/integrity.go
@@ -55,7 +55,6 @@ func (t *fingerprintTransformation) Key() internal.ResourceTransformationKey {
// Transform creates a MD5 hash of the Resource content and inserts that hash before
// the extension in the filename.
func (t *fingerprintTransformation) Transform(ctx *resources.ResourceTransformationCtx) error {
-
h, err := newHash(t.algo)
if err != nil {
return err
diff --git a/resources/resource_transformers/integrity/integrity_test.go b/resources/resource_transformers/integrity/integrity_test.go
index 3759e6313..8a17fef7a 100644
--- a/resources/resource_transformers/integrity/integrity_test.go
+++ b/resources/resource_transformers/integrity/integrity_test.go
@@ -24,7 +24,6 @@ import (
)
func TestHashFromAlgo(t *testing.T) {
-
for _, algo := range []struct {
name string
bits int
@@ -35,7 +34,6 @@ func TestHashFromAlgo(t *testing.T) {
{"sha512", 512},
{"shaman", -1},
} {
-
t.Run(algo.name, func(t *testing.T) {
c := qt.New(t)
h, err := newHash(algo.name)
@@ -46,7 +44,6 @@ func TestHashFromAlgo(t *testing.T) {
c.Assert(err, qt.Not(qt.IsNil))
c.Assert(err.Error(), qt.Contains, "use either md5, sha256, sha384 or sha512")
}
-
})
}
}
diff --git a/resources/resource_transformers/js/options.go b/resources/resource_transformers/js/options.go
index 925b19956..75daa0cad 100644
--- a/resources/resource_transformers/js/options.go
+++ b/resources/resource_transformers/js/options.go
@@ -212,12 +212,10 @@ func createBuildPlugins(c *Client, opts Options) ([]api.Plugin, error) {
build.OnResolve(api.OnResolveOptions{Filter: `.*`},
func(args api.OnResolveArgs) (api.OnResolveResult, error) {
return resolveImport(args)
-
})
build.OnLoad(api.OnLoadOptions{Filter: `.*`, Namespace: nsImportHugo},
func(args api.OnLoadArgs) (api.OnLoadResult, error) {
b, err := ioutil.ReadFile(args.Path)
-
if err != nil {
return api.OnLoadResult{}, errors.Wrapf(err, "failed to read %q", args.Path)
}
@@ -266,11 +264,9 @@ func createBuildPlugins(c *Client, opts Options) ([]api.Plugin, error) {
}
return []api.Plugin{importResolver, paramsPlugin}, nil
-
}
func toBuildOptions(opts Options) (buildOptions api.BuildOptions, err error) {
-
var target api.Target
switch opts.Target {
case "", "esnext":
@@ -336,8 +332,8 @@ func toBuildOptions(opts Options) (buildOptions api.BuildOptions, err error) {
}
// By default we only need to specify outDir and no outFile
- var outDir = opts.outDir
- var outFile = ""
+ outDir := opts.outDir
+ outFile := ""
var sourceMap api.SourceMap
switch opts.SourceMap {
case "inline":
@@ -381,5 +377,4 @@ func toBuildOptions(opts Options) (buildOptions api.BuildOptions, err error) {
},
}
return
-
}
diff --git a/resources/resource_transformers/js/options_test.go b/resources/resource_transformers/js/options_test.go
index ef8c203ce..f07ccc26b 100644
--- a/resources/resource_transformers/js/options_test.go
+++ b/resources/resource_transformers/js/options_test.go
@@ -76,7 +76,8 @@ func TestToBuildOptions(t *testing.T) {
opts, err = toBuildOptions(Options{
Target: "es2018", Format: "cjs", Minify: true, mediaType: media.JavascriptType,
- SourceMap: "inline"})
+ SourceMap: "inline",
+ })
c.Assert(err, qt.IsNil)
c.Assert(opts, qt.DeepEquals, api.BuildOptions{
Bundle: true,
@@ -93,7 +94,8 @@ func TestToBuildOptions(t *testing.T) {
opts, err = toBuildOptions(Options{
Target: "es2018", Format: "cjs", Minify: true, mediaType: media.JavascriptType,
- SourceMap: "inline"})
+ SourceMap: "inline",
+ })
c.Assert(err, qt.IsNil)
c.Assert(opts, qt.DeepEquals, api.BuildOptions{
Bundle: true,
@@ -107,5 +109,4 @@ func TestToBuildOptions(t *testing.T) {
Loader: api.LoaderJS,
},
})
-
}
diff --git a/resources/resource_transformers/minifier/minify.go b/resources/resource_transformers/minifier/minify.go
index 060485e80..51a3f4047 100644
--- a/resources/resource_transformers/minifier/minify.go
+++ b/resources/resource_transformers/minifier/minify.go
@@ -57,5 +57,4 @@ func (c *Client) Minify(res resources.ResourceTransformer) (resource.Resource, e
rs: c.rs,
m: c.m,
})
-
}
diff --git a/resources/resource_transformers/minifier/minify_test.go b/resources/resource_transformers/minifier/minify_test.go
index 38828c17c..b0ebe3171 100644
--- a/resources/resource_transformers/minifier/minify_test.go
+++ b/resources/resource_transformers/minifier/minify_test.go
@@ -39,5 +39,4 @@ func TestTransform(t *testing.T) {
content, err := transformed.(resource.ContentProvider).Content()
c.Assert(err, qt.IsNil)
c.Assert(content, qt.Equals, "
Hugo Rocks!
")
-
}
diff --git a/resources/resource_transformers/postcss/postcss.go b/resources/resource_transformers/postcss/postcss.go
index daeb7212a..8ba40ebd1 100644
--- a/resources/resource_transformers/postcss/postcss.go
+++ b/resources/resource_transformers/postcss/postcss.go
@@ -19,6 +19,7 @@ import (
"encoding/hex"
"io"
"io/ioutil"
+ "os/exec"
"path"
"path/filepath"
"regexp"
@@ -36,8 +37,6 @@ import (
"github.com/gohugoio/hugo/hugofs"
"github.com/pkg/errors"
- "os/exec"
-
"github.com/mitchellh/mapstructure"
"github.com/gohugoio/hugo/common/herrors"
@@ -139,7 +138,6 @@ func (t *postcssTransformation) Key() internal.ResourceTransformationKey {
// npm install -g postcss-cli
// npm install -g autoprefixer
func (t *postcssTransformation) Transform(ctx *resources.ResourceTransformationCtx) error {
-
const localPostCSSPath = "node_modules/.bin/"
const binaryName = "postcss"
@@ -174,7 +172,6 @@ func (t *postcssTransformation) Transform(ctx *resources.ResourceTransformationC
if configFile == "" && t.options.Config != "" {
// Only fail if the user specificed config file is not found.
return errors.Errorf("postcss config %q not found:", configFile)
-
}
}
@@ -271,7 +268,6 @@ func (imp *importResolver) importRecursive(
lineNum int,
content string,
inPath string) (int, string, error) {
-
basePath := path.Dir(inPath)
var replacements []string
@@ -350,7 +346,6 @@ func (imp *importResolver) resolve() (io.Reader, error) {
}
return strings.NewReader(newContent), nil
-
}
// See https://www.w3schools.com/cssref/pr_import_rule.asp
diff --git a/resources/resource_transformers/postcss/postcss_test.go b/resources/resource_transformers/postcss/postcss_test.go
index a49487c97..c5f855445 100644
--- a/resources/resource_transformers/postcss/postcss_test.go
+++ b/resources/resource_transformers/postcss/postcss_test.go
@@ -44,7 +44,6 @@ func TestDecodeOptions(t *testing.T) {
c.Assert(err, qt.IsNil)
c.Assert(opts2.NoMap, qt.Equals, true)
-
}
func TestShouldImport(t *testing.T) {
@@ -117,7 +116,6 @@ E_STYLE
Offset: 1,
Filename: "d.css",
})
-
}
func BenchmarkImportResolver(b *testing.B) {
diff --git a/resources/resource_transformers/tocss/scss/client_test.go b/resources/resource_transformers/tocss/scss/client_test.go
index f9adac226..9dddd3869 100644
--- a/resources/resource_transformers/tocss/scss/client_test.go
+++ b/resources/resource_transformers/tocss/scss/client_test.go
@@ -46,5 +46,4 @@ func TestReplaceRegularCSSImports(t *testing.T) {
reverted := replaceRegularImportsOut(res)
c.Assert(reverted, qt.Equals, scssWithImport)
-
}
diff --git a/resources/resource_transformers/tocss/scss/tocss.go b/resources/resource_transformers/tocss/scss/tocss.go
index fc7a19f33..f4f15fad1 100644
--- a/resources/resource_transformers/tocss/scss/tocss.go
+++ b/resources/resource_transformers/tocss/scss/tocss.go
@@ -127,7 +127,7 @@ func (t *toCSSTransformation) Transform(ctx *resources.ResourceTransformationCtx
// more correct for the main entry path (main.scss typically), but
// it will mess up the import mappings. As a workaround, we do a replacement
// in the source map itself (see below).
- //options.InputPath = inputPath
+ // options.InputPath = inputPath
options.to.SourceMapOptions.OutputPath = outName
options.to.SourceMapOptions.Contents = true
options.to.SourceMapOptions.OmitURL = false
diff --git a/resources/testhelpers_test.go b/resources/testhelpers_test.go
index 0462f7ecd..32e4213ea 100644
--- a/resources/testhelpers_test.go
+++ b/resources/testhelpers_test.go
@@ -1,15 +1,14 @@
package resources
import (
- "path/filepath"
- "testing"
-
"image"
"io"
"io/ioutil"
"os"
+ "path/filepath"
"runtime"
"strings"
+ "testing"
"github.com/gohugoio/hugo/langs"
"github.com/gohugoio/hugo/modules"
@@ -51,11 +50,9 @@ func createTestCfg() *viper.Viper {
cfg.Set("allModules", modules.Modules{mod})
return cfg
-
}
func newTestResourceSpec(desc specDescriptor) *Spec {
-
baseURL := desc.baseURL
if baseURL == "" {
baseURL = "https://example.com/"
@@ -133,7 +130,6 @@ func newTestResourceOsFs(c *qt.C) (*Spec, string) {
c.Assert(err, qt.IsNil)
return spec, workDir
-
}
func fetchSunset(c *qt.C) resource.Image {
diff --git a/resources/transform.go b/resources/transform.go
index 354a20eec..d995bb46b 100644
--- a/resources/transform.go
+++ b/resources/transform.go
@@ -293,7 +293,6 @@ func (r *resourceAdapter) publish() {
r.spec.Logger.Errorf("Failed to publish Resource: %s", r.publisherErr)
}
})
-
}
func (r *resourceAdapter) TransformationKey() string {
@@ -397,7 +396,6 @@ func (r *resourceAdapter) transform(publish, setContent bool) error {
}
newErr := func(err error) error {
-
msg := fmt.Sprintf("%s: failed to transform %q (%s)", strings.ToUpper(tr.Key().Name), tctx.InPath, tctx.InMediaType.Type())
if err == herrors.ErrFeatureNotAvailable {
@@ -416,7 +414,6 @@ func (r *resourceAdapter) transform(publish, setContent bool) error {
}
return errors.Wrap(err, msg)
-
}
var tryFileCache bool
diff --git a/resources/transform_test.go b/resources/transform_test.go
index b2dad2210..488fefd6e 100644
--- a/resources/transform_test.go
+++ b/resources/transform_test.go
@@ -385,11 +385,10 @@ func TestTransform(t *testing.T) {
resizedNotPublished, err := img.Resize("50x50")
c.Assert(err, qt.IsNil)
c.Assert(resizedNotPublished.Height(), qt.Equals, 50)
- //c.Assert(resized.RelPermalink(), qt.Equals, "/gopher.changed_hu2e827f5a78333ebc04166dd643235dea_1462_50x50_resize_linear_2.png")
+ // c.Assert(resized.RelPermalink(), qt.Equals, "/gopher.changed_hu2e827f5a78333ebc04166dd643235dea_1462_50x50_resize_linear_2.png")
assertShouldExist(c, spec, "public/gopher.changed_hu2e827f5a78333ebc04166dd643235dea_1462_50x50_resize_linear_2.png", false)
assertNoDuplicateWrites(c, spec)
-
})
c.Run("Concurrent", func(c *qt.C) {
diff --git a/scripts/fork_go_templates/main.go b/scripts/fork_go_templates/main.go
index 04202b254..c295ab734 100644
--- a/scripts/fork_go_templates/main.go
+++ b/scripts/fork_go_templates/main.go
@@ -35,7 +35,6 @@ func main() {
goimports(htmlRoot)
gofmt(forkRoot)
-
}
const (
@@ -97,36 +96,41 @@ package parse
}
return content
-
}
var goPackages = []goPackage{
- goPackage{srcPkg: "text/template", dstPkg: "texttemplate",
- replacer: func(name, content string) string { return textTemplateReplacers.Replace(commonReplace(name, content)) }},
- goPackage{srcPkg: "html/template", dstPkg: "htmltemplate", replacer: func(name, content string) string {
- if strings.HasSuffix(name, "content.go") {
- // Remove template.HTML types. We need to use the Go types.
- content = removeAll(`(?s)// Strings of content.*?\)\n`, content)
- }
+ {
+ srcPkg: "text/template", dstPkg: "texttemplate",
+ replacer: func(name, content string) string { return textTemplateReplacers.Replace(commonReplace(name, content)) },
+ },
+ {
+ srcPkg: "html/template", dstPkg: "htmltemplate", replacer: func(name, content string) string {
+ if strings.HasSuffix(name, "content.go") {
+ // Remove template.HTML types. We need to use the Go types.
+ content = removeAll(`(?s)// Strings of content.*?\)\n`, content)
+ }
- content = commonReplace(name, content)
+ content = commonReplace(name, content)
- return htmlTemplateReplacers.Replace(content)
- },
+ return htmlTemplateReplacers.Replace(content)
+ },
rewriter: func(name string) {
for _, s := range []string{"CSS", "HTML", "HTMLAttr", "JS", "JSStr", "URL", "Srcset"} {
rewrite(name, fmt.Sprintf("%s -> htmltemplate.%s", s, s))
}
rewrite(name, `"text/template/parse" -> "github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate/parse"`)
- }},
- goPackage{srcPkg: "internal/fmtsort", dstPkg: "fmtsort", rewriter: func(name string) {
+ },
+ },
+ {srcPkg: "internal/fmtsort", dstPkg: "fmtsort", rewriter: func(name string) {
rewrite(name, `"internal/fmtsort" -> "github.com/gohugoio/hugo/tpl/internal/go_templates/fmtsort"`)
}},
- goPackage{srcPkg: "internal/testenv", dstPkg: "testenv",
+ {
+ srcPkg: "internal/testenv", dstPkg: "testenv",
replacer: func(name, content string) string { return testEnvReplacers.Replace(content) }, rewriter: func(name string) {
rewrite(name, `"internal/testenv" -> "github.com/gohugoio/hugo/tpl/internal/go_templates/testenv"`)
- }},
- goPackage{srcPkg: "internal/cfg", dstPkg: "cfg", rewriter: func(name string) {
+ },
+ },
+ {srcPkg: "internal/cfg", dstPkg: "cfg", rewriter: func(name string) {
rewrite(name, `"internal/cfg" -> "github.com/gohugoio/hugo/tpl/internal/go_templates/cfg"`)
}},
}
@@ -196,7 +200,6 @@ func doWithGoFiles(dir string,
func removeAll(expression, content string) string {
re := regexp.MustCompile(expression)
return re.ReplaceAllString(content, "")
-
}
func rewrite(filename, rule string) {
diff --git a/source/fileInfo.go b/source/fileInfo.go
index 849afa45e..4e7866315 100644
--- a/source/fileInfo.go
+++ b/source/fileInfo.go
@@ -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
-
}
diff --git a/source/fileInfo_test.go b/source/fileInfo_test.go
index 1c9da7e41..b8bb33cd3 100644
--- a/source/fileInfo_test.go
+++ b/source/fileInfo_test.go
@@ -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)
}
-
}
diff --git a/source/filesystem.go b/source/filesystem.go
index ce62c15a4..1cd75f032 100644
--- a/source/filesystem.go
+++ b/source/filesystem.go
@@ -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() {
diff --git a/source/filesystem_test.go b/source/filesystem_test.go
index ec7a305dc..5dc187978 100644
--- a/source/filesystem_test.go
+++ b/source/filesystem_test.go
@@ -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 {
diff --git a/source/sourceSpec.go b/source/sourceSpec.go
index 504a3a22d..e8407a14d 100644
--- a/source/sourceSpec.go
+++ b/source/sourceSpec.go
@@ -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.
diff --git a/tpl/cast/cast_test.go b/tpl/cast/cast_test.go
index d3f8d9733..c6219728b 100644
--- a/tpl/cast/cast_test.go
+++ b/tpl/cast/cast_test.go
@@ -15,7 +15,6 @@ package cast
import (
"html/template"
-
"testing"
qt "github.com/frankban/quicktest"
diff --git a/tpl/cast/docshelper.go b/tpl/cast/docshelper.go
index a497f6e8a..035db1740 100644
--- a/tpl/cast/docshelper.go
+++ b/tpl/cast/docshelper.go
@@ -41,7 +41,6 @@ func init() {
}
return docshelper.DocProvider{"tpl": map[string]interface{}{"funcs": namespaces}}
-
}
docshelper.AddDocProviderFunc(docsProvider)
diff --git a/tpl/cast/init.go b/tpl/cast/init.go
index 3aee6f036..3f1f3f253 100644
--- a/tpl/cast/init.go
+++ b/tpl/cast/init.go
@@ -51,7 +51,6 @@ func init() {
)
return ns
-
}
internal.AddTemplateFuncsNamespace(f)
diff --git a/tpl/cast/init_test.go b/tpl/cast/init_test.go
index 73d9d5adc..dd024b775 100644
--- a/tpl/cast/init_test.go
+++ b/tpl/cast/init_test.go
@@ -38,5 +38,4 @@ func TestInit(t *testing.T) {
c.Assert(found, qt.Equals, true)
c.Assert(ns.Context(), hqt.IsSameType, &Namespace{})
-
}
diff --git a/tpl/collections/append.go b/tpl/collections/append.go
index 297328dc8..50fafe3d9 100644
--- a/tpl/collections/append.go
+++ b/tpl/collections/append.go
@@ -34,5 +34,4 @@ func (ns *Namespace) Append(args ...interface{}) (interface{}, error) {
from := args[:len(args)-1]
return collections.Append(to, from...)
-
}
diff --git a/tpl/collections/append_test.go b/tpl/collections/append_test.go
index a254601b4..9dcc7d2b9 100644
--- a/tpl/collections/append_test.go
+++ b/tpl/collections/append_test.go
@@ -40,9 +40,11 @@ func TestAppend(t *testing.T) {
{"", []interface{}{[]string{"a", "b"}}, false},
{[]string{"a", "b"}, []interface{}{}, false},
// No string concatenation.
- {"ab",
+ {
+ "ab",
[]interface{}{"c"},
- false},
+ false,
+ },
} {
errMsg := qt.Commentf("[%d]", i)
@@ -62,5 +64,4 @@ func TestAppend(t *testing.T) {
t.Fatalf("%s got\n%T: %v\nexpected\n%T: %v", errMsg, result, result, test.expected, test.expected)
}
}
-
}
diff --git a/tpl/collections/apply.go b/tpl/collections/apply.go
index 55d29d3a9..86554def1 100644
--- a/tpl/collections/apply.go
+++ b/tpl/collections/apply.go
@@ -52,7 +52,6 @@ func (ns *Namespace) Apply(seq interface{}, fname string, args ...interface{}) (
vv := seqv.Index(i)
vvv, err := applyFnToThis(fnv, vv, args...)
-
if err != nil {
return nil, err
}
diff --git a/tpl/collections/apply_test.go b/tpl/collections/apply_test.go
index f9199b6b6..98cb78b51 100644
--- a/tpl/collections/apply_test.go
+++ b/tpl/collections/apply_test.go
@@ -14,12 +14,11 @@
package collections
import (
+ "fmt"
"io"
"reflect"
"testing"
- "fmt"
-
qt "github.com/frankban/quicktest"
"github.com/gohugoio/hugo/deps"
"github.com/gohugoio/hugo/output"
@@ -58,7 +57,6 @@ func (templateFinder) GetFunc(name string) (reflect.Value, bool) {
}
return reflect.ValueOf(fmt.Sprint), true
-
}
func TestApply(t *testing.T) {
@@ -88,5 +86,4 @@ func TestApply(t *testing.T) {
if err == nil {
t.Errorf("apply with unknown func should fail")
}
-
}
diff --git a/tpl/collections/collections.go b/tpl/collections/collections.go
index d90467022..3521f9cd5 100644
--- a/tpl/collections/collections.go
+++ b/tpl/collections/collections.go
@@ -18,7 +18,6 @@ package collections
import (
"fmt"
"html/template"
-
"math/rand"
"net/url"
"reflect"
@@ -478,9 +477,9 @@ func (ns *Namespace) Seq(args ...interface{}) ([]int, error) {
return nil, errors.New("invalid arguments to Seq")
}
- var inc = 1
+ inc := 1
var last int
- var first = intArgs[0]
+ first := intArgs[0]
if len(intArgs) == 1 {
last = first
@@ -580,7 +579,6 @@ type intersector struct {
}
func (i *intersector) appendIfNotSeen(v reflect.Value) {
-
vi := v.Interface()
if !i.seen[vi] {
i.r = reflect.Append(i.r, v)
@@ -729,7 +727,6 @@ func (ns *Namespace) Uniq(seq interface{}) (interface{}, error) {
}
return slice.Interface(), nil
-
}
// KeyVals creates a key and values wrapper.
diff --git a/tpl/collections/collections_test.go b/tpl/collections/collections_test.go
index 21c8bfb56..a75ec9d16 100644
--- a/tpl/collections/collections_test.go
+++ b/tpl/collections/collections_test.go
@@ -17,7 +17,6 @@ import (
"errors"
"fmt"
"html/template"
-
"math/rand"
"reflect"
"testing"
@@ -195,8 +194,10 @@ func TestDictionary(t *testing.T) {
}{
{[]interface{}{"a", "b"}, map[string]interface{}{"a": "b"}},
{[]interface{}{[]string{"a", "b"}, "c"}, map[string]interface{}{"a": map[string]interface{}{"b": "c"}}},
- {[]interface{}{[]string{"a", "b"}, "c", []string{"a", "b2"}, "c2", "b", "c"},
- map[string]interface{}{"a": map[string]interface{}{"b": "c", "b2": "c2"}, "b": "c"}},
+ {
+ []interface{}{[]string{"a", "b"}, "c", []string{"a", "b2"}, "c2", "b", "c"},
+ map[string]interface{}{"a": map[string]interface{}{"b": "c", "b2": "c2"}, "b": "c"},
+ },
{[]interface{}{"a", 12, "b", []int{4}}, map[string]interface{}{"a": 12, "b": []int{4}}},
// errors
{[]interface{}{5, "b"}, false},
@@ -237,7 +238,6 @@ func TestReverse(t *testing.T) {
c.Assert(reversed, qt.IsNil)
_, err = ns.Reverse(43)
c.Assert(err, qt.Not(qt.IsNil))
-
}
func TestEchoParam(t *testing.T) {
@@ -369,8 +369,10 @@ func (p testPage) String() string {
return "p-" + p.Title
}
-type pagesPtr []*testPage
-type pagesVals []testPage
+type (
+ pagesPtr []*testPage
+ pagesVals []testPage
+)
var (
p1 = &testPage{"A"}
@@ -716,7 +718,6 @@ func TestSlice(t *testing.T) {
c.Assert(result, qt.DeepEquals, test.expected, errMsg)
}
-
}
func TestUnion(t *testing.T) {
@@ -907,7 +908,6 @@ type TstParams struct {
func (x TstParams) Params() maps.Params {
return x.params
-
}
type TstXIHolder struct {
diff --git a/tpl/collections/complement_test.go b/tpl/collections/complement_test.go
index d0e27353c..7e8d695b4 100644
--- a/tpl/collections/complement_test.go
+++ b/tpl/collections/complement_test.go
@@ -66,7 +66,8 @@ func TestComplement(t *testing.T) {
{"error", []interface{}{[]string{"c", "d"}, []string{"a", "b"}}, false},
{[]string{"a", "b", "c"}, []interface{}{[][]string{{"c", "d"}}}, false},
{
- []interface{}{[][]string{{"c", "d"}}}, []interface{}{[]string{"c", "d"}, []string{"a", "b"}},
+ []interface{}{[][]string{{"c", "d"}}},
+ []interface{}{[]string{"c", "d"}, []string{"a", "b"}},
[]interface{}{[][]string{{"c", "d"}}},
},
} {
@@ -93,5 +94,4 @@ func TestComplement(t *testing.T) {
c.Assert(err, qt.Not(qt.IsNil))
_, err = ns.Complement([]string{"a", "b"})
c.Assert(err, qt.Not(qt.IsNil))
-
}
diff --git a/tpl/collections/index_test.go b/tpl/collections/index_test.go
index 0c380d8d5..c690fe648 100644
--- a/tpl/collections/index_test.go
+++ b/tpl/collections/index_test.go
@@ -52,7 +52,6 @@ func TestIndex(t *testing.T) {
{[]int{0, 1}, []interface{}{nil}, nil, true},
{tstNoStringer{}, []interface{}{0}, nil, true},
} {
-
c.Run(fmt.Sprint(i), func(c *qt.C) {
errMsg := qt.Commentf("[%d] %v", i, test)
diff --git a/tpl/collections/merge_test.go b/tpl/collections/merge_test.go
index 92c973cd4..bde4d90b1 100644
--- a/tpl/collections/merge_test.go
+++ b/tpl/collections/merge_test.go
@@ -43,7 +43,8 @@ func TestMerge(t *testing.T) {
map[string]interface{}{"a": 42, "c": 3},
map[string]interface{}{"a": 1, "b": 2},
},
- map[string]interface{}{"a": 1, "b": 2, "c": 3}, false,
+ map[string]interface{}{"a": 1, "b": 2, "c": 3},
+ false,
},
{
"multi",
@@ -52,7 +53,8 @@ func TestMerge(t *testing.T) {
map[string]interface{}{"a": 1, "b": 2},
map[string]interface{}{"a": 9, "c": 4, "d": 7},
},
- map[string]interface{}{"a": 9, "b": 2, "c": 4, "d": 7, "e": 11}, false,
+ map[string]interface{}{"a": 9, "b": 2, "c": 4, "d": 7, "e": 11},
+ false,
},
{
"basic case insensitive",
@@ -60,7 +62,8 @@ func TestMerge(t *testing.T) {
map[string]interface{}{"A": 42, "c": 3},
map[string]interface{}{"a": 1, "b": 2},
},
- map[string]interface{}{"a": 1, "b": 2, "c": 3}, false,
+ map[string]interface{}{"a": 1, "b": 2, "c": 3},
+ false,
},
{
"nested",
@@ -68,7 +71,8 @@ func TestMerge(t *testing.T) {
map[string]interface{}{"a": 42, "c": 3, "b": map[string]interface{}{"d": 55, "e": 66, "f": 3}},
map[string]interface{}{"a": 1, "b": map[string]interface{}{"d": 1, "e": 2}},
},
- map[string]interface{}{"a": 1, "b": map[string]interface{}{"d": 1, "e": 2, "f": 3}, "c": 3}, false,
+ map[string]interface{}{"a": 1, "b": map[string]interface{}{"d": 1, "e": 2, "f": 3}, "c": 3},
+ false,
},
{
// https://github.com/gohugoio/hugo/issues/6633
@@ -77,7 +81,8 @@ func TestMerge(t *testing.T) {
map[string]interface{}{"a": 42, "c": 3},
maps.Params{"a": 1, "b": 2},
},
- maps.Params{"a": int(1), "b": int(2), "c": int(3)}, false,
+ maps.Params{"a": int(1), "b": int(2), "c": int(3)},
+ false,
},
{
"params dst, upper case src",
@@ -85,7 +90,8 @@ func TestMerge(t *testing.T) {
map[string]interface{}{"a": 42, "C": 3},
maps.Params{"a": 1, "b": 2},
},
- maps.Params{"a": int(1), "b": int(2), "c": int(3)}, false,
+ maps.Params{"a": int(1), "b": int(2), "c": int(3)},
+ false,
},
{
"params src",
@@ -93,7 +99,8 @@ func TestMerge(t *testing.T) {
maps.Params{"a": 42, "c": 3},
map[string]interface{}{"a": 1, "c": 2},
},
- map[string]interface{}{"a": int(1), "c": int(2)}, false,
+ map[string]interface{}{"a": int(1), "c": int(2)},
+ false,
},
{
"params src, upper case dst",
@@ -101,7 +108,8 @@ func TestMerge(t *testing.T) {
maps.Params{"a": 42, "c": 3},
map[string]interface{}{"a": 1, "C": 2},
},
- map[string]interface{}{"a": int(1), "C": int(2)}, false,
+ map[string]interface{}{"a": int(1), "C": int(2)},
+ false,
},
{
"nested, params dst",
@@ -109,7 +117,8 @@ func TestMerge(t *testing.T) {
map[string]interface{}{"a": 42, "c": 3, "b": map[string]interface{}{"d": 55, "e": 66, "f": 3}},
maps.Params{"a": 1, "b": maps.Params{"d": 1, "e": 2}},
},
- maps.Params{"a": 1, "b": maps.Params{"d": 1, "e": 2, "f": 3}, "c": 3}, false,
+ maps.Params{"a": 1, "b": maps.Params{"d": 1, "e": 2, "f": 3}, "c": 3},
+ false,
},
{
// https://github.com/gohugoio/hugo/issues/7899
@@ -118,7 +127,8 @@ func TestMerge(t *testing.T) {
map[string]interface{}{"k": "v"},
map[string]interface{}{"k": map[string]interface{}{"k2": "v2"}},
},
- map[string]interface{}{"k": map[string]interface{}{"k2": "v2"}}, false,
+ map[string]interface{}{"k": map[string]interface{}{"k2": "v2"}},
+ false,
},
{"src nil", []interface{}{nil, simpleMap}, simpleMap, false},
// Error cases.
diff --git a/tpl/collections/reflect_helpers.go b/tpl/collections/reflect_helpers.go
index 3d73b70e1..453d2f356 100644
--- a/tpl/collections/reflect_helpers.go
+++ b/tpl/collections/reflect_helpers.go
@@ -165,7 +165,6 @@ func convertNumber(v reflect.Value, to reflect.Kind) (reflect.Value, error) {
}
return n, nil
-
}
func newSliceElement(items interface{}) interface{} {
diff --git a/tpl/collections/sort_test.go b/tpl/collections/sort_test.go
index 75e23fc7b..4798b5090 100644
--- a/tpl/collections/sort_test.go
+++ b/tpl/collections/sort_test.go
@@ -238,7 +238,6 @@ func TestSort(t *testing.T) {
},
{nil, nil, "asc", false},
} {
-
t.Run(fmt.Sprintf("test%d", i), func(t *testing.T) {
var result interface{}
var err error
@@ -261,6 +260,5 @@ func TestSort(t *testing.T) {
}
}
})
-
}
}
diff --git a/tpl/collections/symdiff.go b/tpl/collections/symdiff.go
index 85a2076aa..e61814e26 100644
--- a/tpl/collections/symdiff.go
+++ b/tpl/collections/symdiff.go
@@ -65,5 +65,4 @@ func (ns *Namespace) SymDiff(s2, s1 interface{}) (interface{}, error) {
}
return slice.Interface(), nil
-
}
diff --git a/tpl/collections/symdiff_test.go b/tpl/collections/symdiff_test.go
index ac40fda55..120dfaac6 100644
--- a/tpl/collections/symdiff_test.go
+++ b/tpl/collections/symdiff_test.go
@@ -75,5 +75,4 @@ func TestSymDiff(t *testing.T) {
c.Assert(err, qt.Not(qt.IsNil))
_, err = ns.Complement([]string{"a", "b"})
c.Assert(err, qt.Not(qt.IsNil))
-
}
diff --git a/tpl/collections/where_test.go b/tpl/collections/where_test.go
index d6a1dd141..75ee109f9 100644
--- a/tpl/collections/where_test.go
+++ b/tpl/collections/where_test.go
@@ -62,7 +62,6 @@ func TestWhere(t *testing.T) {
}
return testVariants
-
}
for i, test := range []testt{
@@ -171,17 +170,17 @@ func TestWhere(t *testing.T) {
},
key: "B", match: "b2",
expect: []maps.Params{
- maps.Params{"a": "a2", "b": "b2"},
+ {"a": "a2", "b": "b2"},
},
},
{
seq: []maps.Params{
- maps.Params{
+ {
"a": map[string]interface{}{
"b": "b1",
},
},
- maps.Params{
+ {
"a": map[string]interface{}{
"b": "b2",
},
@@ -189,7 +188,7 @@ func TestWhere(t *testing.T) {
},
key: "A.B", match: "b2",
expect: []maps.Params{
- maps.Params{
+ {
"a": map[string]interface{}{
"b": "b2",
},
diff --git a/tpl/compare/compare_test.go b/tpl/compare/compare_test.go
index c21ca11bc..76fe2698a 100644
--- a/tpl/compare/compare_test.go
+++ b/tpl/compare/compare_test.go
@@ -44,8 +44,10 @@ var testT = &T{
NonEmptyInterfaceTypedNil: (*T)(nil),
}
-type tstEqerType1 string
-type tstEqerType2 string
+type (
+ tstEqerType1 string
+ tstEqerType2 string
+)
func (t tstEqerType2) Eq(other interface{}) bool {
return cast.ToString(t) == cast.ToString(other)
@@ -397,7 +399,6 @@ func TestCase(t *testing.T) {
c.Assert(n.Eq("az", "az"), qt.Equals, true)
c.Assert(n.Eq("az", stringType("az")), qt.Equals, true)
-
}
func TestStringType(t *testing.T) {
diff --git a/tpl/compare/init.go b/tpl/compare/init.go
index 3b9dc6856..f96e382e5 100644
--- a/tpl/compare/init.go
+++ b/tpl/compare/init.go
@@ -79,7 +79,6 @@ func init() {
)
return ns
-
}
internal.AddTemplateFuncsNamespace(f)
diff --git a/tpl/crypto/init.go b/tpl/crypto/init.go
index 9a958bd38..2c6e94298 100644
--- a/tpl/crypto/init.go
+++ b/tpl/crypto/init.go
@@ -59,7 +59,6 @@ func init() {
)
return ns
-
}
internal.AddTemplateFuncsNamespace(f)
diff --git a/tpl/data/data.go b/tpl/data/data.go
index 964844336..15d042e0a 100644
--- a/tpl/data/data.go
+++ b/tpl/data/data.go
@@ -35,7 +35,6 @@ import (
// New returns a new instance of the data-namespaced template functions.
func New(deps *deps.Deps) *Namespace {
-
return &Namespace{
deps: deps,
cacheGetCSV: deps.FileCaches.GetCSVCache(),
diff --git a/tpl/data/data_test.go b/tpl/data/data_test.go
index e1839dd48..f9e8621f2 100644
--- a/tpl/data/data_test.go
+++ b/tpl/data/data_test.go
@@ -109,7 +109,7 @@ func TestGetCSV(t *testing.T) {
if _, ok := test.expect.(bool); ok {
c.Assert(int(ns.deps.Log.LogCounters().ErrorCounter.Count()), qt.Equals, 1)
- //c.Assert(err, msg, qt.Not(qt.IsNil))
+ // c.Assert(err, msg, qt.Not(qt.IsNil))
c.Assert(got, qt.IsNil)
continue
}
@@ -199,7 +199,7 @@ func TestGetJSON(t *testing.T) {
if _, ok := test.expect.(bool); ok {
c.Assert(int(ns.deps.Log.LogCounters().ErrorCounter.Count()), qt.Equals, 1)
- //c.Assert(err, msg, qt.Not(qt.IsNil))
+ // c.Assert(err, msg, qt.Not(qt.IsNil))
continue
}
diff --git a/tpl/data/resources.go b/tpl/data/resources.go
index a7b8b3f49..ba98f12b4 100644
--- a/tpl/data/resources.go
+++ b/tpl/data/resources.go
@@ -81,7 +81,6 @@ func (ns *Namespace) getRemote(cache *filecache.Cache, unmarshal func([]byte) (b
}
return nil, err
-
})
if !handled {
@@ -100,7 +99,6 @@ func getLocal(url string, fs afero.Fs, cfg config.Provider) ([]byte, error) {
}
return afero.ReadFile(fs, filename)
-
}
// getResource loads the content of a local or remote file and returns its content and the
diff --git a/tpl/data/resources_test.go b/tpl/data/resources_test.go
index 7350f82f1..5ad0f0970 100644
--- a/tpl/data/resources_test.go
+++ b/tpl/data/resources_test.go
@@ -69,7 +69,6 @@ func TestScpGetLocal(t *testing.T) {
t.Errorf("\nExpected: %s\nActual: %s\n", string(test.content), string(c))
}
}
-
}
func getTestServer(handler func(w http.ResponseWriter, r *http.Request)) (*httptest.Server, *http.Client) {
diff --git a/tpl/fmt/fmt.go b/tpl/fmt/fmt.go
index 780add0d1..713088b57 100644
--- a/tpl/fmt/fmt.go
+++ b/tpl/fmt/fmt.go
@@ -50,7 +50,6 @@ func (ns *Namespace) Print(a ...interface{}) string {
// Printf returns a formatted string representation of the passed arguments.
func (ns *Namespace) Printf(format string, a ...interface{}) string {
return _fmt.Sprintf(format, a...)
-
}
// Println returns string representation of the passed arguments ending with a newline.
diff --git a/tpl/hugo/init.go b/tpl/hugo/init.go
index 1556b759c..c57d4a27a 100644
--- a/tpl/hugo/init.go
+++ b/tpl/hugo/init.go
@@ -23,7 +23,6 @@ const name = "hugo"
func init() {
f := func(d *deps.Deps) *internal.TemplateFuncsNamespace {
-
h := d.Site.Hugo()
ns := &internal.TemplateFuncsNamespace{
@@ -34,7 +33,6 @@ func init() {
// We just add the Hugo struct as the namespace here. No method mappings.
return ns
-
}
internal.AddTemplateFuncsNamespace(f)
diff --git a/tpl/images/init.go b/tpl/images/init.go
index 299c76846..e9fd52e73 100644
--- a/tpl/images/init.go
+++ b/tpl/images/init.go
@@ -35,7 +35,6 @@ func init() {
)
return ns
-
}
internal.AddTemplateFuncsNamespace(f)
diff --git a/tpl/inflect/init.go b/tpl/inflect/init.go
index 3f258356b..52b234df3 100644
--- a/tpl/inflect/init.go
+++ b/tpl/inflect/init.go
@@ -54,7 +54,6 @@ func init() {
)
return ns
-
}
internal.AddTemplateFuncsNamespace(f)
diff --git a/tpl/internal/go_templates/fmtsort/sort_test.go b/tpl/internal/go_templates/fmtsort/sort_test.go
index 364c5bf6d..189c693cc 100644
--- a/tpl/internal/go_templates/fmtsort/sort_test.go
+++ b/tpl/internal/go_templates/fmtsort/sort_test.go
@@ -6,11 +6,12 @@ package fmtsort_test
import (
"fmt"
- "github.com/gohugoio/hugo/tpl/internal/go_templates/fmtsort"
"math"
"reflect"
"strings"
"testing"
+
+ "github.com/gohugoio/hugo/tpl/internal/go_templates/fmtsort"
)
var compareTests = [][]reflect.Value{
diff --git a/tpl/internal/go_templates/htmltemplate/content_test.go b/tpl/internal/go_templates/htmltemplate/content_test.go
index b5de701d3..f2c5c5ed1 100644
--- a/tpl/internal/go_templates/htmltemplate/content_test.go
+++ b/tpl/internal/go_templates/htmltemplate/content_test.go
@@ -427,7 +427,7 @@ func TestStringer(t *testing.T) {
if err := tmpl.Execute(b, s); err != nil {
t.Fatal(err)
}
- var expect = "string=3"
+ expect := "string=3"
if b.String() != expect {
t.Errorf("expected %q got %q", expect, b.String())
}
diff --git a/tpl/internal/go_templates/htmltemplate/css.go b/tpl/internal/go_templates/htmltemplate/css.go
index eb92fc92b..b006a0718 100644
--- a/tpl/internal/go_templates/htmltemplate/css.go
+++ b/tpl/internal/go_templates/htmltemplate/css.go
@@ -210,8 +210,10 @@ var cssReplacementTable = []string{
'}': `\7d`,
}
-var expressionBytes = []byte("expression")
-var mozBindingBytes = []byte("mozbinding")
+var (
+ expressionBytes = []byte("expression")
+ mozBindingBytes = []byte("mozbinding")
+)
// cssValueFilter allows innocuous CSS values in the output including CSS
// quantities (10px or 25%), ID or class literals (#foo, .bar), keyword values
diff --git a/tpl/internal/go_templates/htmltemplate/escape_test.go b/tpl/internal/go_templates/htmltemplate/escape_test.go
index 075db4e13..ee5421cc8 100644
--- a/tpl/internal/go_templates/htmltemplate/escape_test.go
+++ b/tpl/internal/go_templates/htmltemplate/escape_test.go
@@ -891,7 +891,6 @@ func TestEscapeSet(t *testing.T) {
t.Errorf("want\n\t%q\ngot\n\t%q", test.want, got)
}
}
-
}
func TestErrors(t *testing.T) {
@@ -1088,7 +1087,6 @@ func TestErrors(t *testing.T) {
// Check that we get the same error if we call Execute again.
if err := tmpl.Execute(buf, nil); err == nil || err.Error() != got {
t.Errorf("input=%q: unexpected error on second call %q", test.input, err)
-
}
}
}
diff --git a/tpl/internal/go_templates/htmltemplate/example_test.go b/tpl/internal/go_templates/htmltemplate/example_test.go
index a93b8d2fb..ee1cbbb4a 100644
--- a/tpl/internal/go_templates/htmltemplate/example_test.go
+++ b/tpl/internal/go_templates/htmltemplate/example_test.go
@@ -82,7 +82,6 @@ func Example() {
//
no rows
//