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

@@ -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())
}

View File

@@ -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

View File

@@ -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)
}
}
}

View File

@@ -82,7 +82,6 @@ func Example() {
// <div><strong>no rows</strong></div>
// </body>
// </html>
}
func Example_autoescaping() {
@@ -123,7 +122,6 @@ func Example_escape() {
// \"Fran \u0026 Freddie\'s Diner\" \u003Ctasty@example.com\u003E
// \"Fran \u0026 Freddie\'s Diner\"32\u003Ctasty@example.com\u003E
// %22Fran+%26+Freddie%27s+Diner%2232%3Ctasty%40example.com%3E
}
func ExampleTemplate_Delims() {

View File

@@ -337,6 +337,7 @@ var jsStrNormReplacementTable = []string{
'<': `\u003c`,
'>': `\u003e`,
}
var jsRegexpReplacementTable = []string{
0: `\u0000`,
'\t': `\t`,

View File

@@ -206,7 +206,8 @@ func TestJSStrEscaper(t *testing.T) {
{"<!--", `\u003c!--`},
{"-->", `--\u003e`},
// From https://code.google.com/p/doctype/wiki/ArticleUtf7
{"+ADw-script+AD4-alert(1)+ADw-/script+AD4-",
{
"+ADw-script+AD4-alert(1)+ADw-/script+AD4-",
`\u002bADw-script\u002bAD4-alert(1)\u002bADw-\/script\u002bAD4-`,
},
// Invalid UTF-8 sequence

View File

@@ -41,8 +41,10 @@ var transitionFunc = [...]func(context, []byte) (context, int){
stateError: tError,
}
var commentStart = []byte("<!--")
var commentEnd = []byte("-->")
var (
commentStart = []byte("<!--")
commentEnd = []byte("-->")
)
// tText is the context transition function for the text state.
func tText(c context, s []byte) (context, int) {

View File

@@ -42,7 +42,6 @@ func TestFindEndTag(t *testing.T) {
}
func BenchmarkTemplateSpecialTags(b *testing.B) {
r := struct {
Name, Gift string
}{"Aunt Mildred", "bone china tea set"}