enhance: Migrate remaining gopkg.in/yaml.v3 usages to go.yaml.in/yaml/v4 (#37866)

### Description
Replaces all remaining direct `gopkg.in/yaml.v3` imports with
`go.yaml.in/yaml/v4` across models, modules, routers, services, and
integration tests. `gopkg.in/yaml.v3` moves from a direct to an indirect
dependency in `go.mod`.

#### API compatibility

The yaml.Node type, node.Kind/node.Content traversal style
(modules/markup/markdown/convertyaml.go), and the
UnmarshalYAML(*yaml.Node) interface signature
(modules/optional/serialization.go) are all preserved in v4 — no
call-site changes were required beyond the import path.

**Related:**
- https://github.com/go-gitea/gitea/pull/36564#issuecomment-4526536805

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Claude (Opus 4.8) <noreply@anthropic.com>
This commit is contained in:
Pascal Zimmermann
2026-05-29 03:12:11 +02:00
committed by GitHub
parent 90d443b46c
commit ea723fe482
24 changed files with 26 additions and 26 deletions
+2 -2
View File
@@ -10,7 +10,7 @@ import (
"strings"
"time"
"gopkg.in/yaml.v3"
"go.yaml.in/yaml/v4"
)
// StateType issue state type
@@ -231,7 +231,7 @@ func (l *IssueTemplateStringSlice) UnmarshalYAML(value *yaml.Node) error {
*l = labels
return nil
}
return fmt.Errorf("line %d: cannot unmarshal %s into IssueTemplateStringSlice", value.Line, value.ShortTag())
return fmt.Errorf("cannot unmarshal %s into IssueTemplateStringSlice", value.ShortTag())
}
type IssueConfigContactLink struct {
+2 -2
View File
@@ -7,7 +7,7 @@ import (
"testing"
"github.com/stretchr/testify/assert"
"gopkg.in/yaml.v3"
"go.yaml.in/yaml/v4"
)
func TestIssueTemplate_Type(t *testing.T) {
@@ -88,7 +88,7 @@ labels:
b: bb
`,
tmpl: &IssueTemplate{},
wantErr: "line 3: cannot unmarshal !!map into IssueTemplateStringSlice",
wantErr: "yaml: unmarshal errors:\n line 3: cannot unmarshal !!map into IssueTemplateStringSlice",
},
}
for _, tt := range tests {