From 85ae6e9ae3c4222d68faee0c44a1fd105a2e04b4 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Sat, 22 Mar 2025 01:37:06 +0000 Subject: [PATCH] feat(go)!: upgrade to Go 1.17 (from 1.15) (#6) BREAKING CHANGE: Go 1.17 or later is now required, up from Go 1.15. --- .github/workflows/ci.yml | 7 +++++-- go.mod | 9 ++++++--- go.sum | 19 ++++++++++++------- golden_test.go | 11 ++++++----- update_test.go | 11 ++++++----- 5 files changed, 35 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ba17331..0a3f608 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,14 +61,17 @@ jobs: - macos-latest - windows-latest go_version: - - "1.15" - - "1.16" - "1.17" + - "1.18" + - "1.19" + - "1.20" + - "stable" runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: go-version: ${{ matrix.go_version }} + check-latest: true - name: Run tests run: go test -v -count=1 -race ./... diff --git a/go.mod b/go.mod index 6182b53..f05be6e 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,11 @@ module github.com/jimeh/go-golden -go 1.15 +go 1.17 + +require github.com/stretchr/testify v1.10.0 require ( - github.com/jimeh/envctl v0.1.0 - github.com/stretchr/testify v1.7.0 + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 341eccf..3ebac7b 100644 --- a/go.sum +++ b/go.sum @@ -1,14 +1,19 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/jimeh/envctl v0.1.0 h1:KTv3D+pi5M4/PgFVE/W8ssWqiZP3pDJ8Cga50L+1avo= -github.com/jimeh/envctl v0.1.0/go.mod h1:aM27ffBbO1yUBKUzgJGCUorS4z+wyh+qhQe1ruxXZZo= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/golden_test.go b/golden_test.go index a077a32..2027fe8 100644 --- a/golden_test.go +++ b/golden_test.go @@ -6,7 +6,6 @@ import ( "path/filepath" "testing" - "github.com/jimeh/envctl" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -433,11 +432,13 @@ func TestSetP(t *testing.T) { func TestUpdate(t *testing.T) { for _, tt := range envUpdateFuncTestCases { t.Run(tt.name, func(t *testing.T) { - envctl.WithClean(tt.env, func() { - got := Update() + for k, v := range tt.env { + t.Setenv(k, v) + } - assert.Equal(t, tt.want, got) - }) + got := Update() + + assert.Equal(t, tt.want, got) }) } } diff --git a/update_test.go b/update_test.go index 26937a7..dca7ddd 100644 --- a/update_test.go +++ b/update_test.go @@ -3,7 +3,6 @@ package golden import ( "testing" - "github.com/jimeh/envctl" "github.com/stretchr/testify/assert" ) @@ -96,11 +95,13 @@ var envUpdateFuncTestCases = []struct { func TestEnvUpdateFunc(t *testing.T) { for _, tt := range envUpdateFuncTestCases { t.Run(tt.name, func(t *testing.T) { - envctl.WithClean(tt.env, func() { - got := EnvUpdateFunc() + for k, v := range tt.env { + t.Setenv(k, v) + } - assert.Equal(t, tt.want, got) - }) + got := EnvUpdateFunc() + + assert.Equal(t, tt.want, got) }) } }