all: Format code with gofumpt

See https://github.com/mvdan/gofumpt
This commit is contained in:
Bjørn Erik Pedersen
2020-12-02 13:23:25 +01:00
parent 32471b57bd
commit d90e37e0c6
442 changed files with 1426 additions and 2254 deletions

View File

@@ -46,13 +46,16 @@ func init() {
[][2]string{
{
`{{ htmlEscape "Cathal Garvey & The Sunshine Band <cathal@foo.bar>" | safeHTML}}`,
`Cathal Garvey &amp; The Sunshine Band &lt;cathal@foo.bar&gt;`},
`Cathal Garvey &amp; The Sunshine Band &lt;cathal@foo.bar&gt;`,
},
{
`{{ htmlEscape "Cathal Garvey & The Sunshine Band <cathal@foo.bar>"}}`,
`Cathal Garvey &amp;amp; The Sunshine Band &amp;lt;cathal@foo.bar&amp;gt;`},
`Cathal Garvey &amp;amp; The Sunshine Band &amp;lt;cathal@foo.bar&amp;gt;`,
},
{
`{{ htmlEscape "Cathal Garvey & The Sunshine Band <cathal@foo.bar>" | htmlUnescape | safeHTML }}`,
`Cathal Garvey & The Sunshine Band <cathal@foo.bar>`},
`Cathal Garvey & The Sunshine Band <cathal@foo.bar>`,
},
},
)
@@ -61,16 +64,20 @@ func init() {
[][2]string{
{
`{{ htmlUnescape "Cathal Garvey &amp; The Sunshine Band &lt;cathal@foo.bar&gt;" | safeHTML}}`,
`Cathal Garvey & The Sunshine Band <cathal@foo.bar>`},
`Cathal Garvey & The Sunshine Band <cathal@foo.bar>`,
},
{
`{{"Cathal Garvey &amp;amp; The Sunshine Band &amp;lt;cathal@foo.bar&amp;gt;" | htmlUnescape | htmlUnescape | safeHTML}}`,
`Cathal Garvey & The Sunshine Band <cathal@foo.bar>`},
`Cathal Garvey & The Sunshine Band <cathal@foo.bar>`,
},
{
`{{"Cathal Garvey &amp;amp; The Sunshine Band &amp;lt;cathal@foo.bar&amp;gt;" | htmlUnescape | htmlUnescape }}`,
`Cathal Garvey &amp; The Sunshine Band &lt;cathal@foo.bar&gt;`},
`Cathal Garvey &amp; The Sunshine Band &lt;cathal@foo.bar&gt;`,
},
{
`{{ htmlUnescape "Cathal Garvey &amp; The Sunshine Band &lt;cathal@foo.bar&gt;" | htmlEscape | safeHTML }}`,
`Cathal Garvey &amp; The Sunshine Band &lt;cathal@foo.bar&gt;`},
`Cathal Garvey &amp; The Sunshine Band &lt;cathal@foo.bar&gt;`,
},
},
)
@@ -104,7 +111,6 @@ func init() {
)
return ns
}
internal.AddTemplateFuncsNamespace(f)

View File

@@ -107,7 +107,6 @@ title: Test Metadata
}
}
}
func TestRemarshalComments(t *testing.T) {
@@ -168,7 +167,6 @@ func TestTestRemarshalError(t *testing.T) {
_, err = ns.Remarshal("json", "asdf")
c.Assert(err, qt.Not(qt.IsNil))
}
func TestTestRemarshalMapInput(t *testing.T) {

View File

@@ -98,7 +98,6 @@ func (ns *Namespace) Markdownify(s interface{}) (template.HTML, error) {
}
b, err := ns.deps.ContentSpec.RenderMarkdown([]byte(ss))
if err != nil {
return "", err
}

View File

@@ -15,7 +15,6 @@ package transform
import (
"html/template"
"testing"
"github.com/gohugoio/hugo/common/loggers"
@@ -206,7 +205,6 @@ And then some.
c.Assert(err, qt.IsNil)
c.Assert(result, qt.Equals, template.HTML(
"<p>#First</p>\n<p>This is some <em>bold</em> text.</p>\n<h2 id=\"second\">Second</h2>\n<p>This is some more text.</p>\n<p>And then some.</p>\n"))
}
func TestPlainify(t *testing.T) {

View File

@@ -39,7 +39,7 @@ func (ns *Namespace) Unmarshal(args ...interface{}) (interface{}, error) {
}
var data interface{}
var decoder = metadecoders.Default
decoder := metadecoders.Default
if len(args) == 1 {
data = args[0]

View File

@@ -79,7 +79,6 @@ func (t testContentResource) Key() string {
}
func TestUnmarshal(t *testing.T) {
v := viper.New()
ns := New(newDeps(v))
c := qt.New(t)
@@ -120,21 +119,17 @@ func TestUnmarshal(t *testing.T) {
}},
{testContentResource{key: "r1", content: `a;b;c`, mime: media.CSVType}, map[string]interface{}{"delimiter": ";"}, func(r [][]string) {
c.Assert([][]string{{"a", "b", "c"}}, qt.DeepEquals, r)
}},
{"a,b,c", nil, func(r [][]string) {
c.Assert([][]string{{"a", "b", "c"}}, qt.DeepEquals, r)
}},
{"a;b;c", map[string]interface{}{"delimiter": ";"}, func(r [][]string) {
c.Assert([][]string{{"a", "b", "c"}}, qt.DeepEquals, r)
}},
{testContentResource{key: "r1", content: `
% This is a comment
a;b;c`, mime: media.CSVType}, map[string]interface{}{"DElimiter": ";", "Comment": "%"}, func(r [][]string) {
c.Assert([][]string{{"a", "b", "c"}}, qt.DeepEquals, r)
}},
// errors
{"thisisnotavaliddataformat", nil, false},