Skip to content

Commit 3b214a5

Browse files
authored
Merge branch 'main' into fix-pprof-label
2 parents e7ec573 + f47fb4f commit 3b214a5

File tree

22 files changed

+773
-1963
lines changed

22 files changed

+773
-1963
lines changed

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ COMMA := ,
2626
XGO_VERSION := go-1.23.x
2727

2828
AIR_PACKAGE ?= github.com/air-verse/air@v1
29-
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/cmd/editorconfig-checker@2.7.0
29+
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/v3/cmd/editorconfig-checker@v3.0.3
3030
GOFUMPT_PACKAGE ?= mvdan.cc/[email protected]
3131
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/[email protected]
32-
GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/[email protected].11
33-
MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/misspell@v0.5.1
32+
GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/[email protected].12
33+
MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/misspell@v0.6.0
3434
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/[email protected]
3535
XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest
3636
GO_LICENSES_PACKAGE ?= github.com/google/go-licenses@v1
3737
GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@v1
3838
ACTIONLINT_PACKAGE ?= github.com/rhysd/actionlint/cmd/actionlint@v1
39-
GOPLS_PACKAGE ?= golang.org/x/tools/gopls@v0.15.3
39+
GOPLS_PACKAGE ?= golang.org/x/tools/gopls@v0.17.0
4040

4141
DOCKER_IMAGE ?= gitea/gitea
4242
DOCKER_TAG ?= latest

modules/markup/common/linkify.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type GlobalVarsType struct {
2424
LinkRegex *regexp.Regexp // fast matching a URL link, no any extra validation.
2525
}
2626

27-
var GlobalVars = sync.OnceValue[*GlobalVarsType](func() *GlobalVarsType {
27+
var GlobalVars = sync.OnceValue(func() *GlobalVarsType {
2828
v := &GlobalVarsType{}
2929
v.wwwURLRegxp = regexp.MustCompile(`^www\.[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}((?:/|[#?])[-a-zA-Z0-9@:%_\+.~#!?&//=\(\);,'">\^{}\[\]` + "`" + `]*)?`)
3030
v.LinkRegex, _ = xurls.StrictMatchingScheme("https?://")

modules/markup/html.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ type globalVarsType struct {
4242
nulCleaner *strings.Replacer
4343
}
4444

45-
var globalVars = sync.OnceValue[*globalVarsType](func() *globalVarsType {
45+
var globalVars = sync.OnceValue(func() *globalVarsType {
4646
v := &globalVarsType{}
4747
// NOTE: All below regex matching do not perform any extra validation.
4848
// Thus a link is produced even if the linked entity does not exist.

modules/markup/internal/renderinternal.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
"golang.org/x/net/html"
1818
)
1919

20-
var reAttrClass = sync.OnceValue[*regexp.Regexp](func() *regexp.Regexp {
20+
var reAttrClass = sync.OnceValue(func() *regexp.Regexp {
2121
// TODO: it isn't a problem at the moment because our HTML contents are always well constructed
2222
return regexp.MustCompile(`(<[^>]+)\s+class="([^"]+)"([^>]*>)`)
2323
})

modules/markup/markdown/goldmark.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func (g *ASTTransformer) Transform(node *ast.Document, reader text.Reader, pc pa
112112
}
113113

114114
// it is copied from old code, which is quite doubtful whether it is correct
115-
var reValidIconName = sync.OnceValue[*regexp.Regexp](func() *regexp.Regexp {
115+
var reValidIconName = sync.OnceValue(func() *regexp.Regexp {
116116
return regexp.MustCompile(`^[-\w]+$`) // old: regexp.MustCompile("^[a-z ]+$")
117117
})
118118

modules/packages/arch/metadata.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ var (
4343
ErrInvalidArchitecture = util.NewInvalidArgumentErrorf("package architecture is invalid")
4444

4545
// https://man.archlinux.org/man/PKGBUILD.5
46-
namePattern = regexp.MustCompile(`\A[a-zA-Z0-9@._+-]+\z`)
47-
versionPattern = regexp.MustCompile(`\A(?:[0-9]:)?[a-zA-Z0-9.+~]+(?:-[a-zA-Z0-9.+-~]+)?\z`)
46+
namePattern = regexp.MustCompile(`\A[a-zA-Z0-9@._+-]+\z`)
47+
// (epoch:pkgver-pkgrel)
48+
versionPattern = regexp.MustCompile(`\A(?:\d:)?[\w.+~]+(?:-[-\w.+~]+)?\z`)
4849
)
4950

5051
type Package struct {

modules/packages/arch/metadata_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,14 @@ func TestParsePackageInfo(t *testing.T) {
122122
assert.ErrorIs(t, err, ErrInvalidName)
123123
})
124124

125+
t.Run("Regexp", func(t *testing.T) {
126+
assert.Regexp(t, versionPattern, "1.2_3~4+5")
127+
assert.Regexp(t, versionPattern, "1:2_3~4+5")
128+
assert.NotRegexp(t, versionPattern, "a:1.0.0-1")
129+
assert.NotRegexp(t, versionPattern, "0.0.1/1-1")
130+
assert.NotRegexp(t, versionPattern, "1.0.0 -1")
131+
})
132+
125133
t.Run("InvalidVersion", func(t *testing.T) {
126134
data := createPKGINFOContent(packageName, "")
127135

modules/util/time_str.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ type timeStrGlobalVarsType struct {
2525
// In the future, it could be some configurable options to help users
2626
// to convert the working time to different units.
2727

28-
var timeStrGlobalVars = sync.OnceValue[*timeStrGlobalVarsType](func() *timeStrGlobalVarsType {
28+
var timeStrGlobalVars = sync.OnceValue(func() *timeStrGlobalVarsType {
2929
v := &timeStrGlobalVarsType{}
3030
v.re = regexp.MustCompile(`(?i)(\d+)\s*([hms])`)
3131
v.units = []struct {

modules/util/util_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,10 @@ func TestReserveLineBreakForTextarea(t *testing.T) {
242242
}
243243

244244
func TestOptionalArg(t *testing.T) {
245-
foo := func(other any, optArg ...int) int {
245+
foo := func(_ any, optArg ...int) int {
246246
return OptionalArg(optArg)
247247
}
248-
bar := func(other any, optArg ...int) int {
248+
bar := func(_ any, optArg ...int) int {
249249
return OptionalArg(optArg, 42)
250250
}
251251
assert.Equal(t, 0, foo(nil))

0 commit comments

Comments
 (0)