Skip to content
Myr

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

5 files+14 added−4 removed

modified:binding/yaml.go+1 added-1 removed
7 unmodified lines
8 "bytes"9 "io"10 "net/http"1112 "gopkg.in/yaml.v3"12 "github.com/goccy/go-yaml"13)1415type yamlBinding struct{}16
19 unmodified lines
modified:render/render_test.go+8 added-1 removed
283 unmodified lines
284 assert.Equal(t, "application/yaml; charset=utf-8", w.Header().Get("Content-Type"))285286 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())288289 // 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}298299type fail struct{}
329 unmodified lines
modified:render/yaml.go+1 added-1 removed
5 unmodified lines
67import (8 "net/http"910 "gopkg.in/yaml.v3"10 "github.com/goccy/go-yaml"11)1213// YAML contains the given interface object.14type YAML struct {
22 unmodified lines
modified:go.mod+2 added-1 removed
5 unmodified lines
6 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.4
1 unmodified line
16 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)2122require (23 github.com/bytedance/sonic/loader v0.2.4 // indirect
18 unmodified lines
42 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 lines
29github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=30github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=31github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=32github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=33github.com/goccy/go-yaml v1.18.0 h1:8W7wMFS12Pcas7KU+VVkaiCng+kG8QiFeFwzFb+rwuw=34github.com/goccy/go-yaml v1.18.0/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=35github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=36github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=37github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=38github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
72 unmodified lines