Bump to go 1.21 in go.mod

This commit is contained in:
Bjørn Erik Pedersen 2024-08-01 10:27:55 +02:00
parent 071f8b4466
commit 92573012e8
14 changed files with 50 additions and 50 deletions

2
go.mod
View file

@ -163,4 +163,4 @@ require (
toolchain go1.21.0 toolchain go1.21.0
go 1.20 go 1.21

View file

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build go1.13 && !windows //go:build !windows
// +build go1.13,!windows // +build !windows
package template package template

View file

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build go1.13 && !windows //go:build !windows
// +build go1.13,!windows // +build !windows
package template package template
@ -428,7 +428,7 @@ func TestStringer(t *testing.T) {
if err := tmpl.Execute(b, s); err != nil { if err := tmpl.Execute(b, s); err != nil {
t.Fatal(err) t.Fatal(err)
} }
var expect = "string=3" expect := "string=3"
if b.String() != expect { if b.String() != expect {
t.Errorf("expected %q got %q", expect, b.String()) t.Errorf("expected %q got %q", expect, b.String())
} }

View file

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build go1.13 && !windows //go:build !windows
// +build go1.13,!windows // +build !windows
package template package template

View file

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build go1.13 && !windows //go:build !windows
// +build go1.13,!windows // +build !windows
package template package template
@ -944,7 +944,6 @@ func TestEscapeSet(t *testing.T) {
t.Errorf("want\n\t%q\ngot\n\t%q", test.want, got) t.Errorf("want\n\t%q\ngot\n\t%q", test.want, got)
} }
} }
} }
func TestErrors(t *testing.T) { func TestErrors(t *testing.T) {
@ -1194,7 +1193,6 @@ func TestErrors(t *testing.T) {
// Check that we get the same error if we call Execute again. // Check that we get the same error if we call Execute again.
if err := tmpl.Execute(buf, nil); err == nil || err.Error() != got { if err := tmpl.Execute(buf, nil); err == nil || err.Error() != got {
t.Errorf("input=%q: unexpected error on second call %q", test.input, err) t.Errorf("input=%q: unexpected error on second call %q", test.input, err)
} }
} }
} }

View file

@ -2,9 +2,6 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build go1.13
// +build go1.13
package template_test package template_test
import ( import (
@ -83,7 +80,6 @@ func Example() {
// <div><strong>no rows</strong></div> // <div><strong>no rows</strong></div>
// </body> // </body>
// </html> // </html>
} }
func Example_autoescaping() { func Example_autoescaping() {
@ -124,7 +120,6 @@ func Example_escape() {
// \"Fran \u0026 Freddie\'s Diner\" \u003Ctasty@example.com\u003E // \"Fran \u0026 Freddie\'s Diner\" \u003Ctasty@example.com\u003E
// \"Fran \u0026 Freddie\'s Diner\"32\u003Ctasty@example.com\u003E // \"Fran \u0026 Freddie\'s Diner\"32\u003Ctasty@example.com\u003E
// %22Fran+%26+Freddie%27s+Diner%2232%3Ctasty%40example.com%3E // %22Fran+%26+Freddie%27s+Diner%2232%3Ctasty%40example.com%3E
} }
func ExampleTemplate_Delims() { func ExampleTemplate_Delims() {

View file

@ -4,8 +4,8 @@
// Tests for template execution, copied from text/template. // Tests for template execution, copied from text/template.
//go:build go1.13 && !windows //go:build !windows
// +build go1.13,!windows // +build !windows
package template package template

View file

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build go1.13 && !windows //go:build !windows
// +build go1.13,!windows // +build !windows
package template package template

View file

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build go1.13 && !windows //go:build !windows
// +build go1.13,!windows // +build !windows
package template package template
@ -221,7 +221,8 @@ func TestJSStrEscaper(t *testing.T) {
{"<!--", `\u003c!--`}, {"<!--", `\u003c!--`},
{"-->", `--\u003e`}, {"-->", `--\u003e`},
// From https://code.google.com/p/doctype/wiki/ArticleUtf7 // 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-`, `\u002bADw-script\u002bAD4-alert(1)\u002bADw-\/script\u002bAD4-`,
}, },
// Invalid UTF-8 sequence // Invalid UTF-8 sequence

View file

@ -4,8 +4,8 @@
// Tests for multiple-template execution, copied from text/template. // Tests for multiple-template execution, copied from text/template.
//go:build go1.13 && !windows //go:build !windows
// +build go1.13,!windows // +build !windows
package template package template
@ -268,7 +268,7 @@ func TestIssue19294(t *testing.T) {
// by the contents of "stylesheet", but if the internal map associating // by the contents of "stylesheet", but if the internal map associating
// names with templates is built in the wrong order, the empty block // names with templates is built in the wrong order, the empty block
// looks non-empty and this doesn't happen. // looks non-empty and this doesn't happen.
var inlined = map[string]string{ inlined := map[string]string{
"stylesheet": `{{define "stylesheet"}}stylesheet{{end}}`, "stylesheet": `{{define "stylesheet"}}stylesheet{{end}}`,
"xhtml": `{{block "stylesheet" .}}{{end}}`, "xhtml": `{{block "stylesheet" .}}{{end}}`,
} }

View file

@ -2,9 +2,6 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build go1.13
// +build go1.13
package template_test package template_test
import ( import (
@ -18,7 +15,6 @@ import (
) )
func TestTemplateClone(t *testing.T) { func TestTemplateClone(t *testing.T) {
orig := New("name") orig := New("name")
clone, err := orig.Clone() clone, err := orig.Clone()
if err != nil { if err != nil {

View file

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build go1.13 && !windows //go:build !windows
// +build go1.13,!windows // +build !windows
package template package template
@ -43,7 +43,6 @@ func TestFindEndTag(t *testing.T) {
} }
func BenchmarkTemplateSpecialTags(b *testing.B) { func BenchmarkTemplateSpecialTags(b *testing.B) {
r := struct { r := struct {
Name, Gift string Name, Gift string
}{"Aunt Mildred", "bone china tea set"} }{"Aunt Mildred", "bone china tea set"}

View file

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build go1.13 && !windows //go:build !windows
// +build go1.13,!windows // +build !windows
package template package template

View file

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build go1.13 && !windows //go:build !windows
// +build go1.13,!windows // +build !windows
package template package template
@ -11,10 +11,11 @@ package template
import ( import (
"fmt" "fmt"
"github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate/parse"
"os" "os"
"strings" "strings"
"testing" "testing"
"github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate/parse"
) )
const ( const (
@ -31,22 +32,32 @@ type multiParseTest struct {
} }
var multiParseTests = []multiParseTest{ var multiParseTests = []multiParseTest{
{"empty", "", noError, {
"empty", "", noError,
nil, nil,
nil}, nil,
{"one", `{{define "foo"}} FOO {{end}}`, noError, },
{
"one", `{{define "foo"}} FOO {{end}}`, noError,
[]string{"foo"}, []string{"foo"},
[]string{" FOO "}}, []string{" FOO "},
{"two", `{{define "foo"}} FOO {{end}}{{define "bar"}} BAR {{end}}`, noError, },
{
"two", `{{define "foo"}} FOO {{end}}{{define "bar"}} BAR {{end}}`, noError,
[]string{"foo", "bar"}, []string{"foo", "bar"},
[]string{" FOO ", " BAR "}}, []string{" FOO ", " BAR "},
},
// errors // errors
{"missing end", `{{define "foo"}} FOO `, hasError, {
"missing end", `{{define "foo"}} FOO `, hasError,
nil, nil,
nil},
{"malformed name", `{{define "foo}} FOO `, hasError,
nil, nil,
nil}, },
{
"malformed name", `{{define "foo}} FOO `, hasError,
nil,
nil,
},
} }
func TestMultiParse(t *testing.T) { func TestMultiParse(t *testing.T) {
@ -432,7 +443,7 @@ func TestIssue19294(t *testing.T) {
// by the contents of "stylesheet", but if the internal map associating // by the contents of "stylesheet", but if the internal map associating
// names with templates is built in the wrong order, the empty block // names with templates is built in the wrong order, the empty block
// looks non-empty and this doesn't happen. // looks non-empty and this doesn't happen.
var inlined = map[string]string{ inlined := map[string]string{
"stylesheet": `{{define "stylesheet"}}stylesheet{{end}}`, "stylesheet": `{{define "stylesheet"}}stylesheet{{end}}`,
"xhtml": `{{block "stylesheet" .}}{{end}}`, "xhtml": `{{block "stylesheet" .}}{{end}}`,
} }