summaryrefslogtreecommitdiffstats
path: root/tpl
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-12-02 13:23:25 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-12-03 13:12:58 +0100
commitd90e37e0c6e812f9913bf256c9c81aa05b7a08aa (patch)
tree7b1b14464eefec1188ca2eed53c64e4823453cc9 /tpl
parent32471b57bde51c55a15dbf1db75d6e5f7232c347 (diff)
all: Format code with gofumpt
See https://github.com/mvdan/gofumpt
Diffstat (limited to 'tpl')
-rw-r--r--tpl/cast/cast_test.go1
-rw-r--r--tpl/cast/docshelper.go1
-rw-r--r--tpl/cast/init.go1
-rw-r--r--tpl/cast/init_test.go1
-rw-r--r--tpl/collections/append.go1
-rw-r--r--tpl/collections/append_test.go7
-rw-r--r--tpl/collections/apply.go1
-rw-r--r--tpl/collections/apply_test.go5
-rw-r--r--tpl/collections/collections.go7
-rw-r--r--tpl/collections/collections_test.go16
-rw-r--r--tpl/collections/complement_test.go4
-rw-r--r--tpl/collections/index_test.go1
-rw-r--r--tpl/collections/merge_test.go30
-rw-r--r--tpl/collections/reflect_helpers.go1
-rw-r--r--tpl/collections/sort_test.go2
-rw-r--r--tpl/collections/symdiff.go1
-rw-r--r--tpl/collections/symdiff_test.go1
-rw-r--r--tpl/collections/where_test.go9
-rw-r--r--tpl/compare/compare_test.go7
-rw-r--r--tpl/compare/init.go1
-rw-r--r--tpl/crypto/init.go1
-rw-r--r--tpl/data/data.go1
-rw-r--r--tpl/data/data_test.go4
-rw-r--r--tpl/data/resources.go2
-rw-r--r--tpl/data/resources_test.go1
-rw-r--r--tpl/fmt/fmt.go1
-rw-r--r--tpl/hugo/init.go2
-rw-r--r--tpl/images/init.go1
-rw-r--r--tpl/inflect/init.go1
-rw-r--r--tpl/internal/go_templates/fmtsort/sort_test.go3
-rw-r--r--tpl/internal/go_templates/htmltemplate/content_test.go2
-rw-r--r--tpl/internal/go_templates/htmltemplate/css.go6
-rw-r--r--tpl/internal/go_templates/htmltemplate/escape_test.go2
-rw-r--r--tpl/internal/go_templates/htmltemplate/example_test.go2
-rw-r--r--tpl/internal/go_templates/htmltemplate/js.go1
-rw-r--r--tpl/internal/go_templates/htmltemplate/js_test.go3
-rw-r--r--tpl/internal/go_templates/htmltemplate/transition.go6
-rw-r--r--tpl/internal/go_templates/htmltemplate/transition_test.go1
-rw-r--r--tpl/internal/go_templates/testenv/testenv.go3
-rw-r--r--tpl/internal/go_templates/testenv/testenv_windows.go6
-rw-r--r--tpl/internal/go_templates/texttemplate/example_test.go2
-rw-r--r--tpl/internal/go_templates/texttemplate/exec.go5
-rw-r--r--tpl/internal/go_templates/texttemplate/exec_test.go50
-rw-r--r--tpl/internal/go_templates/texttemplate/hugo_template.go1
-rw-r--r--tpl/internal/go_templates/texttemplate/hugo_template_test.go1
-rw-r--r--tpl/internal/go_templates/texttemplate/multi_test.go35
-rw-r--r--tpl/internal/go_templates/texttemplate/parse/node.go1
-rw-r--r--tpl/internal/go_templates/texttemplate/parse/parse.go2
-rw-r--r--tpl/internal/go_templates/texttemplate/parse/parse_test.go360
-rw-r--r--tpl/internal/go_templates/texttemplate/template.go3
-rw-r--r--tpl/internal/templatefuncsRegistry.go2
-rw-r--r--tpl/js/js.go1
-rw-r--r--tpl/lang/init.go1
-rw-r--r--tpl/math/init.go1
-rw-r--r--tpl/math/math.go2
-rw-r--r--tpl/math/math_test.go1
-rw-r--r--tpl/openapi/openapi3/init.go1
-rw-r--r--tpl/openapi/openapi3/openapi3.go3
-rw-r--r--tpl/os/init.go1
-rw-r--r--tpl/os/os.go2
-rw-r--r--tpl/partials/init.go1
-rw-r--r--tpl/partials/partials.go1
-rw-r--r--tpl/partials/partials_test.go1
-rw-r--r--tpl/path/init.go1
-rw-r--r--tpl/resources/init.go1
-rw-r--r--tpl/resources/resources.go4
-rw-r--r--tpl/safe/init.go1
-rw-r--r--tpl/safe/safe_test.go1
-rw-r--r--tpl/site/init.go2
-rw-r--r--tpl/strings/truncate.go1
-rw-r--r--tpl/strings/truncate_test.go2
-rw-r--r--tpl/template.go3
-rw-r--r--tpl/templates/init.go4
-rw-r--r--tpl/templates/templates.go1
-rw-r--r--tpl/time/init.go1
-rw-r--r--tpl/tplimpl/embedded/generate/generate.go2
-rw-r--r--tpl/tplimpl/shortcodes.go2
-rw-r--r--tpl/tplimpl/shortcodes_test.go6
-rw-r--r--tpl/tplimpl/template.go14
-rw-r--r--tpl/tplimpl/template_ast_transformers.go11
-rw-r--r--tpl/tplimpl/template_ast_transformers_test.go6
-rw-r--r--tpl/tplimpl/template_funcs.go8
-rw-r--r--tpl/tplimpl/template_funcs_test.go5
-rw-r--r--tpl/tplimpl/template_info_test.go2
-rw-r--r--tpl/transform/init.go22
-rw-r--r--tpl/transform/remarshal_test.go2
-rw-r--r--tpl/transform/transform.go1
-rw-r--r--tpl/transform/transform_test.go2
-rw-r--r--tpl/transform/unmarshal.go2
-rw-r--r--tpl/transform/unmarshal_test.go5
-rw-r--r--tpl/urls/init.go1
-rw-r--r--tpl/urls/urls.go2
92 files changed, 393 insertions, 347 deletions
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"}},
+ {