Skip to content

Commit

Permalink
chore: downgrade color and strip color
Browse files Browse the repository at this point in the history
Downgrade fatih/color to keep the 1.15 space insertion behavior.

Strip color from command output in tests for simpler string comparison.
  • Loading branch information
rainest committed Nov 14, 2023
1 parent 2dc5922 commit 27bb40a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ go 1.21.1
replace github.com/yudai/gojsondiff v1.0.0 => github.com/Kong/gojsondiff v1.3.0

require (
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d
github.com/blang/semver/v4 v4.0.0
github.com/daveshanley/vacuum v0.2.7
github.com/fatih/color v1.16.0
github.com/fatih/color v1.15.0
github.com/google/go-cmp v0.6.0
github.com/kong/go-apiops v0.1.23
github.com/kong/go-database-reconciler v0.0.0-20231113164115-13ad8e3cdfbd
github.com/kong/go-database-reconciler v0.0.0-20231113234924-84300ccdeb15
github.com/kong/go-kong v0.48.0
github.com/mitchellh/go-homedir v1.1.0
github.com/spf13/cobra v1.8.0
Expand Down
10 changes: 6 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJ
github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww=
github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpHMqeKTCYkitsPqHNxTmd4SNR5r94FGM8=
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d/go.mod h1:asat636LX7Bqt5lYEZ27JNDcqxfjdBQuJ/MM4CN/Lzo=
github.com/adrg/strutil v0.2.3 h1:WZVn3ItPBovFmP4wMHHVXUr8luRaHrbyIuLlHt32GZQ=
github.com/adrg/strutil v0.2.3/go.mod h1:+SNxbiH6t+O+5SZqIj5n/9i5yUjR+S3XXVrjEcN2mxg=
github.com/atomicgo/cursor v0.0.1/go.mod h1:cBON2QmmrysudxNBFthvMtN32r3jxVRIvzkUiF/RuIk=
Expand Down Expand Up @@ -102,8 +104,8 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m
github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po=
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE=
github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs=
github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw=
github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY=
github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
Expand Down Expand Up @@ -265,8 +267,8 @@ github.com/klauspost/cpuid/v2 v2.2.3 h1:sxCkb+qR91z4vsqw4vGGZlDgPz3G7gjaLyK3V8y7
github.com/klauspost/cpuid/v2 v2.2.3/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY=
github.com/kong/go-apiops v0.1.23 h1:SFDfAS99xt/EchJMWw5pDcYysrFSapZ0L09JeH2dH9M=
github.com/kong/go-apiops v0.1.23/go.mod h1:kFc+1mlnUpmyCqem9O7aes3UaBnezu4WhgDCfrh5zAA=
github.com/kong/go-database-reconciler v0.0.0-20231113164115-13ad8e3cdfbd h1:7TSbT4PdIGvAATg/BMh5bfkCMH3XfgO4nz3e9CAHCUs=
github.com/kong/go-database-reconciler v0.0.0-20231113164115-13ad8e3cdfbd/go.mod h1:RPum8MA7tmdRtGjgpQCAkJMQFQms3MOXpsyWeX4ABng=
github.com/kong/go-database-reconciler v0.0.0-20231113234924-84300ccdeb15 h1:/rFtPT7jkeF7/qHLPVU3SPdFYZpJY6L/+tN96CJJQk8=
github.com/kong/go-database-reconciler v0.0.0-20231113234924-84300ccdeb15/go.mod h1:rtqFAHh3XtiF8IiXqmoMVGv5+yKmaeU3oBDBYm3eubs=
github.com/kong/go-kong v0.48.0 h1:vK1OpoxO50qlKdwPfmx9ChvkTKRsoCCB3b3iHo1umLc=
github.com/kong/go-kong v0.48.0/go.mod h1:qH4CEFqT83ywmu1TlMZX09clQH4B8/dX88CtT/jdv/E=
github.com/kong/go-slugify v0.0.0-20231027194833-8e212cc29c16 h1:twB8aTpaG0t29jL+VYtkZiP5nMOTznt7/q4mPuNa54E=
Expand Down
7 changes: 4 additions & 3 deletions tests/integration/test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os"
"testing"

"github.com/acarl005/stripansi"
"github.com/fatih/color"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
Expand Down Expand Up @@ -285,7 +286,7 @@ func diff(kongFile string, opts ...string) (string, error) {
w.Close()
out, _ := io.ReadAll(r)

return string(out), cmdErr
return stripansi.Strip(string(out)), cmdErr
}

func dump(opts ...string) (string, error) {
Expand All @@ -307,7 +308,7 @@ func dump(opts ...string) (string, error) {
out, _ := io.ReadAll(r)
os.Stdout = rescueStdout

return string(out), cmdErr
return stripansi.Strip(string(out)), cmdErr
}

func lint(opts ...string) (string, error) {
Expand All @@ -329,7 +330,7 @@ func lint(opts ...string) (string, error) {
out, _ := io.ReadAll(r)
os.Stdout = rescueStdout

return string(out), cmdErr
return stripansi.Strip(string(out)), cmdErr
}

func ping(opts ...string) error {
Expand Down

0 comments on commit 27bb40a

Please sign in to comment.