diff options
author | silverwind <me@silverwind.io> | 2024-12-19 19:17:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-19 19:17:55 +0100 |
commit | 626b27bea56a81055a796d452a9ef4fd6e0f4fca (patch) | |
tree | e09993b72ccdb2c919bcc5cba68732460bc5cf28 /modules | |
parent | 581e52b3e78df0da7b31cea107c675dace5e871c (diff) | |
download | gitea-626b27bea56a81055a796d452a9ef4fd6e0f4fca.tar.gz gitea-626b27bea56a81055a796d452a9ef4fd6e0f4fca.zip |
Update go tool dependencies (#32916)
Update all go tool dependencies to latest version. WIP because I think
there are new gopls errors, would like to confirm them on CI first. Here
is from a local run:
```
modules/markup/markdown/goldmark.go:115:37-53: unnecessary type arguments
modules/markup/html.go:45:32-49: unnecessary type arguments
modules/markup/internal/renderinternal.go:20:33-49: unnecessary type arguments
modules/markup/common/linkify.go:27:32-49: unnecessary type arguments
modules/util/time_str.go:28:39-63: unnecessary type arguments
routers/web/repo/pull.go:704:19: impossible condition: non-nil == nil
modules/util/util_test.go:248:14-23: unused parameter: other
```
~~Backport because the `gxz` update might have security benefits.~~
Diffstat (limited to 'modules')
-rw-r--r-- | modules/markup/common/linkify.go | 2 | ||||
-rw-r--r-- | modules/markup/html.go | 2 | ||||
-rw-r--r-- | modules/markup/internal/renderinternal.go | 2 | ||||
-rw-r--r-- | modules/markup/markdown/goldmark.go | 2 | ||||
-rw-r--r-- | modules/util/time_str.go | 2 | ||||
-rw-r--r-- | modules/util/util_test.go | 4 |
6 files changed, 7 insertions, 7 deletions
diff --git a/modules/markup/common/linkify.go b/modules/markup/common/linkify.go index be6ab22b55..52888958fa 100644 --- a/modules/markup/common/linkify.go +++ b/modules/markup/common/linkify.go @@ -24,7 +24,7 @@ type GlobalVarsType struct { LinkRegex *regexp.Regexp // fast matching a URL link, no any extra validation. } -var GlobalVars = sync.OnceValue[*GlobalVarsType](func() *GlobalVarsType { +var GlobalVars = sync.OnceValue(func() *GlobalVarsType { v := &GlobalVarsType{} v.wwwURLRegxp = regexp.MustCompile(`^www\.[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}((?:/|[#?])[-a-zA-Z0-9@:%_\+.~#!?&//=\(\);,'">\^{}\[\]` + "`" + `]*)?`) v.LinkRegex, _ = xurls.StrictMatchingScheme("https?://") diff --git a/modules/markup/html.go b/modules/markup/html.go index 25628db39e..bb12febf27 100644 --- a/modules/markup/html.go +++ b/modules/markup/html.go @@ -42,7 +42,7 @@ type globalVarsType struct { nulCleaner *strings.Replacer } -var globalVars = sync.OnceValue[*globalVarsType](func() *globalVarsType { +var globalVars = sync.OnceValue(func() *globalVarsType { v := &globalVarsType{} // NOTE: All below regex matching do not perform any extra validation. // Thus a link is produced even if the linked entity does not exist. diff --git a/modules/markup/internal/renderinternal.go b/modules/markup/internal/renderinternal.go index 4775fecfc7..4d58f160a9 100644 --- a/modules/markup/internal/renderinternal.go +++ b/modules/markup/internal/renderinternal.go @@ -17,7 +17,7 @@ import ( "golang.org/x/net/html" ) -var reAttrClass = sync.OnceValue[*regexp.Regexp](func() *regexp.Regexp { +var reAttrClass = sync.OnceValue(func() *regexp.Regexp { // TODO: it isn't a problem at the moment because our HTML contents are always well constructed return regexp.MustCompile(`(<[^>]+)\s+class="([^"]+)"([^>]*>)`) }) diff --git a/modules/markup/markdown/goldmark.go b/modules/markup/markdown/goldmark.go index 620a39ebfd..69c2a96ff1 100644 --- a/modules/markup/markdown/goldmark.go +++ b/modules/markup/markdown/goldmark.go @@ -112,7 +112,7 @@ func (g *ASTTransformer) Transform(node *ast.Document, reader text.Reader, pc pa } // it is copied from old code, which is quite doubtful whether it is correct -var reValidIconName = sync.OnceValue[*regexp.Regexp](func() *regexp.Regexp { +var reValidIconName = sync.OnceValue(func() *regexp.Regexp { return regexp.MustCompile(`^[-\w]+$`) // old: regexp.MustCompile("^[a-z ]+$") }) diff --git a/modules/util/time_str.go b/modules/util/time_str.go index b56f4740af..0fccfe82cc 100644 --- a/modules/util/time_str.go +++ b/modules/util/time_str.go @@ -25,7 +25,7 @@ type timeStrGlobalVarsType struct { // In the future, it could be some configurable options to help users // to convert the working time to different units. -var timeStrGlobalVars = sync.OnceValue[*timeStrGlobalVarsType](func() *timeStrGlobalVarsType { +var timeStrGlobalVars = sync.OnceValue(func() *timeStrGlobalVarsType { v := &timeStrGlobalVarsType{} v.re = regexp.MustCompile(`(?i)(\d+)\s*([hms])`) v.units = []struct { diff --git a/modules/util/util_test.go b/modules/util/util_test.go index 5abce08b41..52b05acc5b 100644 --- a/modules/util/util_test.go +++ b/modules/util/util_test.go @@ -242,10 +242,10 @@ func TestReserveLineBreakForTextarea(t *testing.T) { } func TestOptionalArg(t *testing.T) { - foo := func(other any, optArg ...int) int { + foo := func(_ any, optArg ...int) int { return OptionalArg(optArg) } - bar := func(other any, optArg ...int) int { + bar := func(_ any, optArg ...int) int { return OptionalArg(optArg, 42) } assert.Equal(t, 0, foo(nil)) |