chroe: migrate yaml package to github.com/goccy/go-yaml (#4272)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by M. Ilham Surya Pratama · committed by GitHub · parent 688a429 · Browse files · 5 files·+14 added−4 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
5 files+14 added−4 removed
- other:+14 added−4 removed
Provenance
- Commit
cf47752- Tree
1cc851a- Author
M. Ilham Surya Pratama <ilhamsurya26@gmail.com>- Committer
GitHub <noreply@github.com>- Parent
688a429
5 files changed+14 added−4 removed
modified:binding/yaml.go+1 added-1 removed
7 unmodified lines8 "bytes"9 "io"10 "net/http"11 12- "gopkg.in/yaml.v3"12+ "github.com/goccy/go-yaml"13 )14 15 type yamlBinding struct{}16 19 unmodified linesmodified:render/render_test.go+8 added-1 removed
283 unmodified lines284 assert.Equal(t, "application/yaml; charset=utf-8", w.Header().Get("Content-Type"))285 286 err := (YAML{data}).Render(w)287 require.NoError(t, err)288- assert.Equal(t, "|4-\n a : Easy!\n b:\n \tc: 2\n \td: [3, 4]\n \t\n", w.Body.String())288+289+ // With github.com/goccy/go-yaml, the output format is different from gopkg.in/yaml.v3290+ // We're checking that the output contains the expected data, not the exact formatting291+ output := w.Body.String()292+ assert.Contains(t, output, "a : Easy!")293+ assert.Contains(t, output, "b:")294+ assert.Contains(t, output, "c: 2")295+ assert.Contains(t, output, "d: [3, 4]")296 assert.Equal(t, "application/yaml; charset=utf-8", w.Header().Get("Content-Type"))297 }298 299 type fail struct{}329 unmodified linesmodified:render/yaml.go+1 added-1 removed
5 unmodified lines6 7 import (8 "net/http"9 10- "gopkg.in/yaml.v3"10+ "github.com/goccy/go-yaml"11 )12 13 // YAML contains the given interface object.14 type YAML struct {22 unmodified linesmodified:go.mod+2 added-1 removed
5 unmodified lines6 github.com/bytedance/sonic v1.13.27 github.com/gin-contrib/sse v1.1.08 github.com/go-playground/validator/v10 v10.26.09 github.com/goccy/go-json v0.10.210+ github.com/goccy/go-yaml v1.18.011 github.com/json-iterator/go v1.1.1212 github.com/mattn/go-isatty v0.0.2013 github.com/modern-go/reflect2 v1.0.214 github.com/pelletier/go-toml/v2 v2.2.41 unmodified line16 github.com/stretchr/testify v1.10.017 github.com/ugorji/go/codec v1.2.1218 golang.org/x/net v0.41.019 google.golang.org/protobuf v1.36.619- gopkg.in/yaml.v3 v3.0.120 )21 22 require (23 github.com/bytedance/sonic/loader v0.2.4 // indirect18 unmodified lines42 golang.org/x/sync v0.15.0 // indirect43 golang.org/x/sys v0.33.0 // indirect44 golang.org/x/text v0.26.0 // indirect45 golang.org/x/tools v0.33.0 // indirect46+ gopkg.in/yaml.v3 v3.0.1 // indirect47 )modified:go.sum+2 added
28 unmodified lines29 github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=30 github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=31 github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=32 github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=33+github.com/goccy/go-yaml v1.18.0 h1:8W7wMFS12Pcas7KU+VVkaiCng+kG8QiFeFwzFb+rwuw=34+github.com/goccy/go-yaml v1.18.0/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=35 github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=36 github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=37 github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=38 github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=72 unmodified lines