From 08dbac1b7e25f9e933723123faa3d1d41fffc6fe Mon Sep 17 00:00:00 2001 From: Taylor Silva Date: Thu, 13 Mar 2025 13:19:10 -0400 Subject: [PATCH 1/2] use ginkgo v2 and update fake Signed-off-by: Taylor Silva --- check_command_test.go | 2 +- github.go | 6 +++--- github_test.go | 2 +- go.mod | 29 ++++++++++++++++----------- go.sum | 45 +++++++++++++++++++++++++++--------------- in_command_test.go | 2 +- out_command_test.go | 2 +- resource_suite_test.go | 4 +++- 8 files changed, 56 insertions(+), 36 deletions(-) diff --git a/check_command_test.go b/check_command_test.go index 10133ad..5bf4221 100644 --- a/check_command_test.go +++ b/check_command_test.go @@ -1,7 +1,7 @@ package resource_test import ( - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/google/go-github/v66/github" diff --git a/github.go b/github.go index 4cbffa1..2c60721 100644 --- a/github.go +++ b/github.go @@ -14,11 +14,11 @@ import ( "github.com/google/go-github/v66/github" "github.com/shurcooL/githubv4" "golang.org/x/oauth2" -) -// Last run with counterfeiter v6 -//go:generate counterfeiter -o fakes/fake_git_hub.go . GitHub + _ "github.com/maxbrunsfeld/counterfeiter/v6" +) +//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -o fakes/fake_git_hub.go . GitHub type GitHub interface { ListReleases() ([]*github.RepositoryRelease, error) GetReleaseByTag(tag string) (*github.RepositoryRelease, error) diff --git a/github_test.go b/github_test.go index 7211c1b..c090418 100644 --- a/github_test.go +++ b/github_test.go @@ -9,7 +9,7 @@ import ( . "github.com/concourse/github-release-resource" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/google/go-github/v66/github" diff --git a/go.mod b/go.mod index 7468ebd..a50d58b 100644 --- a/go.mod +++ b/go.mod @@ -1,34 +1,39 @@ module github.com/concourse/github-release-resource -go 1.23 +go 1.24.0 -toolchain go1.23.2 +toolchain go1.24.1 require ( github.com/Masterminds/semver v1.5.0 github.com/cppforlife/go-semi-semantic v0.0.0-20160921010311-576b6af77ae4 github.com/google/go-github/v66 v66.0.0 + github.com/maxbrunsfeld/counterfeiter/v6 v6.11.2 github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db - github.com/onsi/ginkgo v1.14.2 - github.com/onsi/gomega v1.34.2 + github.com/onsi/ginkgo/v2 v2.23.0 + github.com/onsi/gomega v1.36.2 github.com/shurcooL/githubv4 v0.0.0-20210922025249-6831e00d857f golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f ) require ( - github.com/fsnotify/fsnotify v1.4.9 // indirect + github.com/go-logr/logr v1.4.2 // indirect + github.com/go-task/slim-sprig/v3 v3.0.0 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/go-querystring v1.1.0 // indirect + github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad // indirect + github.com/kr/pretty v0.2.1 // indirect github.com/nxadm/tail v1.4.5 // indirect + github.com/onsi/ginkgo v1.14.2 // indirect github.com/shurcooL/graphql v0.0.0-20200928012149-18c5c3165e3a // indirect - golang.org/x/net v0.34.0 // indirect - golang.org/x/sys v0.29.0 // indirect - golang.org/x/text v0.21.0 // indirect - golang.org/x/tools v0.26.0 // indirect + golang.org/x/mod v0.23.0 // indirect + golang.org/x/net v0.35.0 // indirect + golang.org/x/sync v0.11.0 // indirect + golang.org/x/sys v0.30.0 // indirect + golang.org/x/text v0.22.0 // indirect + golang.org/x/tools v0.30.0 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/protobuf v1.34.1 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect - gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect + google.golang.org/protobuf v1.36.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 2127dbc..6f9eb20 100644 --- a/go.sum +++ b/go.sum @@ -44,6 +44,8 @@ github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGX github.com/cppforlife/go-semi-semantic v0.0.0-20160921010311-576b6af77ae4 h1:J+ghqo7ZubTzelkjo9hntpTtP/9lUCWH9icEmAW+B+Q= github.com/cppforlife/go-semi-semantic v0.0.0-20160921010311-576b6af77ae4/go.mod h1:socxpf5+mELPbosI149vWpNlHK6mbfWFxSWOoSndXR8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +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/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -111,8 +113,8 @@ github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5 h1:5iH8iuqE5apketRbSFBy+X1V0o+l+8NF1avt4HWl7cA= -github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= +github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad h1:a6HEuzUHeKH6hwfN/ZoQgRgVIWFJljSWa/zetS2WTvg= +github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= @@ -129,6 +131,8 @@ github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfn github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/maxbrunsfeld/counterfeiter/v6 v6.11.2 h1:yVCLo4+ACVroOEr4iFU1iH46Ldlzz2rTuu18Ra7M8sU= +github.com/maxbrunsfeld/counterfeiter/v6 v6.11.2/go.mod h1:VzB2VoMh1Y32/QqDfg9ZJYHj99oM4LiGtqPZydTiQSQ= github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ= github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= @@ -138,21 +142,26 @@ github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.14.2 h1:8mVmC9kjFFmA8H4pKMUhcblgifdkOIXPvbhN1T36q1M= github.com/onsi/ginkgo v1.14.2/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= -github.com/onsi/ginkgo/v2 v2.20.1 h1:YlVIbqct+ZmnEph770q9Q7NVAz4wwIiVNahee6JyUzo= -github.com/onsi/ginkgo/v2 v2.20.1/go.mod h1:lG9ey2Z29hR41WMVthyJBGUBcBhGOtoPF2VFMvBXFCI= +github.com/onsi/ginkgo/v2 v2.23.0 h1:FA1xjp8ieYDzlgS5ABTpdUDB7wtngggONc8a7ku2NqQ= +github.com/onsi/ginkgo/v2 v2.23.0/go.mod h1:zXTP6xIp3U8aVuXN8ENK9IXRaTjFnpVB9mGmaSRvxnM= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.34.2 h1:pNCwDkzrsv7MS9kpaQvVb1aVLahQXyJ/Tv5oAZMI3i8= -github.com/onsi/gomega v1.34.2/go.mod h1:v1xfxRgk0KIsG+QOdm7p8UosrOzPYRo60fd3B/1Dukc= +github.com/onsi/gomega v1.36.2 h1:koNYke6TVk6ZmnyHrCXba/T/MoLBXFjeC1PtvYgw0A8= +github.com/onsi/gomega v1.36.2/go.mod h1:DdwyADRjrc825LhMEkD76cHR5+pUnjhUN8GlHlRPHzY= +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/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8= +github.com/sclevine/spec v1.4.0/go.mod h1:LvpgJaFyvQzRvc1kaDs0bulYwzC70PbiYjC4QnFHkOM= github.com/shurcooL/githubv4 v0.0.0-20210922025249-6831e00d857f h1:q4b8/GCL8Ksl+okhFKSd8DVBQNc0XExjxTO68nK0c3Y= github.com/shurcooL/githubv4 v0.0.0-20210922025249-6831e00d857f/go.mod h1:hAF0iLZy4td2EX+/8Tw+4nodhlMrwN3HupfaXj3zkGo= github.com/shurcooL/graphql v0.0.0-20200928012149-18c5c3165e3a h1:KikTa6HtAK8cS1qjvUvvq4QO21QnwC+EfvB+OAuZ/ZU= github.com/shurcooL/graphql v0.0.0-20200928012149-18c5c3165e3a/go.mod h1:AuYgA5Kyo4c7HfUmvRGs/6rGlMMV/6B1bVnB9JxJEEg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -196,6 +205,8 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.23.0 h1:Zb7khfcRGKk+kqfxFaP5tZqCnDZMjC5VtUBs87Hr6QM= +golang.org/x/mod v0.23.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -224,8 +235,8 @@ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0= -golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= +golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8= +golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -241,6 +252,8 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w= +golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -271,15 +284,15 @@ golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= -golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc= +golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= -golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM= +golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -323,8 +336,8 @@ golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= -golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= +golang.org/x/tools v0.30.0 h1:BgcpHewrV5AUp2G9MebG4XPFI1E2W41zU1SaqVA9vJY= +golang.org/x/tools v0.30.0/go.mod h1:c347cR/OJfw5TI+GfX7RUPNMdDRRbjvYTS0jPyvsVtY= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -406,8 +419,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= -google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.36.1 h1:yBPeRvTftaleIgM3PZ/WBIZ7XM/eEYAaEyCwvyjq/gk= +google.golang.org/protobuf v1.36.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= diff --git a/in_command_test.go b/in_command_test.go index 45e1267..ef82b9e 100644 --- a/in_command_test.go +++ b/in_command_test.go @@ -10,7 +10,7 @@ import ( "path" "path/filepath" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/onsi/gomega/ghttp" diff --git a/out_command_test.go b/out_command_test.go index ab9d961..2da1bce 100644 --- a/out_command_test.go +++ b/out_command_test.go @@ -6,7 +6,7 @@ import ( "os" "path/filepath" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" resource "github.com/concourse/github-release-resource" diff --git a/resource_suite_test.go b/resource_suite_test.go index 890db24..ef4924e 100644 --- a/resource_suite_test.go +++ b/resource_suite_test.go @@ -7,8 +7,10 @@ import ( resource "github.com/concourse/github-release-resource" "github.com/google/go-github/v66/github" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + + _ "github.com/maxbrunsfeld/counterfeiter/v6" ) func TestGithubReleaseResource(t *testing.T) { From e33adc74003aceca1bcb30fea3596e2a273098a7 Mon Sep 17 00:00:00 2001 From: Taylor Silva Date: Thu, 13 Mar 2025 13:29:15 -0400 Subject: [PATCH 2/2] modernize Go code Signed-off-by: Taylor Silva --- github.go | 2 -- github_graphql.go | 4 ++-- github_test.go | 45 +++++++++++++++++++++++++++++++++--------- in_command.go | 13 ++++++------ in_command_test.go | 44 ++++++++++++++++++++--------------------- out_command.go | 5 ++--- out_command_test.go | 10 +++++----- resource_suite_test.go | 10 ++++------ tools.go | 10 ++++++++++ 9 files changed, 87 insertions(+), 56 deletions(-) create mode 100644 tools.go diff --git a/github.go b/github.go index 2c60721..d9189a0 100644 --- a/github.go +++ b/github.go @@ -14,8 +14,6 @@ import ( "github.com/google/go-github/v66/github" "github.com/shurcooL/githubv4" "golang.org/x/oauth2" - - _ "github.com/maxbrunsfeld/counterfeiter/v6" ) //go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -o fakes/fake_git_hub.go . GitHub diff --git a/github_graphql.go b/github_graphql.go index ee6c4c5..b00b322 100644 --- a/github_graphql.go +++ b/github_graphql.go @@ -32,7 +32,7 @@ func (g *GitHubClient) listReleasesV4EnterPrice() ([]*github.RepositoryRelease, } `graphql:"repository(owner:$repositoryOwner,name:$repositoryName)"` } - vars := map[string]interface{}{ + vars := map[string]any{ "repositoryOwner": githubv4.String(g.owner), "repositoryName": githubv4.String(g.repository), "releaseCursor": (*githubv4.String)(nil), @@ -103,7 +103,7 @@ func (g *GitHubClient) listReleasesV4() ([]*github.RepositoryRelease, error) { } `graphql:"repository(owner:$repositoryOwner,name:$repositoryName)"` } - vars := map[string]interface{}{ + vars := map[string]any{ "repositoryOwner": githubv4.String(g.owner), "repositoryName": githubv4.String(g.repository), "releaseCursor": (*githubv4.String)(nil), diff --git a/github_test.go b/github_test.go index c090418..bc604a7 100644 --- a/github_test.go +++ b/github_test.go @@ -2,7 +2,7 @@ package resource_test import ( "fmt" - "io/ioutil" + "io" "net/http" "net/url" "time" @@ -276,9 +276,36 @@ var _ = Describe("GitHub Client", func() { Expect(releases).To(HaveLen(3)) Expect(server.ReceivedRequests()).To(HaveLen(2)) Expect(releases).To(Equal([]*github.RepositoryRelease{ - {TagName: github.String("xyz"), Name: github.String("xyz"), Draft: github.Bool(false), Prerelease: github.Bool(false), ID: github.Int64(32095103), CreatedAt: &github.Timestamp{time.Date(2010, time.October, 01, 00, 58, 07, 0, time.UTC)}, PublishedAt: &github.Timestamp{time.Date(2010, time.October, 02, 15, 39, 53, 0, time.UTC)}, URL: github.String("https://github.com/xyz/xyz/releases/tag/xyz")}, - {TagName: github.String("xyz"), Name: github.String("xyz"), Draft: github.Bool(false), Prerelease: github.Bool(false), ID: github.Int64(30230659), CreatedAt: &github.Timestamp{time.Date(2010, time.August, 27, 13, 55, 36, 0, time.UTC)}, PublishedAt: &github.Timestamp{time.Date(2010, time.August, 27, 17, 18, 06, 0, time.UTC)}, URL: github.String("https://github.com/xyz/xyz/releases/tag/xyz")}, - {TagName: github.String("xyq"), Name: github.String("xyq"), Draft: github.Bool(false), Prerelease: github.Bool(false), ID: github.Int64(33222243), CreatedAt: &github.Timestamp{time.Date(2010, time.October, 10, 01, 01, 07, 0, time.UTC)}, PublishedAt: &github.Timestamp{time.Date(2010, time.October, 10, 15, 39, 53, 0, time.UTC)}, URL: github.String("https://github.com/xyq/xyq/releases/tag/xyq")}, + { + TagName: github.String("xyz"), + Name: github.String("xyz"), + Draft: github.Bool(false), + Prerelease: github.Bool(false), + ID: github.Int64(32095103), + CreatedAt: &github.Timestamp{Time: time.Date(2010, time.October, 01, 00, 58, 07, 0, time.UTC)}, + PublishedAt: &github.Timestamp{Time: time.Date(2010, time.October, 02, 15, 39, 53, 0, time.UTC)}, + URL: github.String("https://github.com/xyz/xyz/releases/tag/xyz"), + }, + { + TagName: github.String("xyz"), + Name: github.String("xyz"), + Draft: github.Bool(false), + Prerelease: github.Bool(false), + ID: github.Int64(30230659), + CreatedAt: &github.Timestamp{Time: time.Date(2010, time.August, 27, 13, 55, 36, 0, time.UTC)}, + PublishedAt: &github.Timestamp{Time: time.Date(2010, time.August, 27, 17, 18, 06, 0, time.UTC)}, + URL: github.String("https://github.com/xyz/xyz/releases/tag/xyz"), + }, + { + TagName: github.String("xyq"), + Name: github.String("xyq"), + Draft: github.Bool(false), + Prerelease: github.Bool(false), + ID: github.Int64(33222243), + CreatedAt: &github.Timestamp{Time: time.Date(2010, time.October, 10, 01, 01, 07, 0, time.UTC)}, + PublishedAt: &github.Timestamp{Time: time.Date(2010, time.October, 10, 15, 39, 53, 0, time.UTC)}, + URL: github.String("https://github.com/xyq/xyq/releases/tag/xyq"), + }, })) }) }) @@ -574,7 +601,7 @@ var _ = Describe("GitHub Client", func() { Expect(err).NotTo(HaveOccurred()) defer readCloser.Close() - body, err := ioutil.ReadAll(readCloser) + body, err := io.ReadAll(readCloser) Expect(err).NotTo(HaveOccurred()) Expect(string(body)).To(Equal(fileContents)) }) @@ -613,7 +640,7 @@ var _ = Describe("GitHub Client", func() { Expect(err).NotTo(HaveOccurred()) defer readCloser.Close() - body, err := ioutil.ReadAll(readCloser) + body, err := io.ReadAll(readCloser) Expect(err).NotTo(HaveOccurred()) Expect(string(body)).To(Equal(redirectFileContents)) }) @@ -635,7 +662,7 @@ var _ = Describe("GitHub Client", func() { Expect(err).NotTo(HaveOccurred()) defer readCloser.Close() - body, err := ioutil.ReadAll(readCloser) + body, err := io.ReadAll(readCloser) Expect(err).NotTo(HaveOccurred()) Expect(string(body)).To(Equal(redirectFileContents)) }) @@ -663,7 +690,7 @@ var _ = Describe("GitHub Client", func() { Expect(err).NotTo(HaveOccurred()) defer readCloser.Close() - body, err := ioutil.ReadAll(readCloser) + body, err := io.ReadAll(readCloser) Expect(err).NotTo(HaveOccurred()) Expect(string(body)).To(Equal(redirectFileContents)) }) @@ -745,7 +772,7 @@ var _ = Describe("GitHub Client", func() { Expect(err).NotTo(HaveOccurred()) defer readCloser.Close() - body, err := ioutil.ReadAll(readCloser) + body, err := io.ReadAll(readCloser) Expect(err).NotTo(HaveOccurred()) Expect(string(body)).To(Equal(redirectFileContents)) }) diff --git a/in_command.go b/in_command.go index b9484ab..9c06257 100644 --- a/in_command.go +++ b/in_command.go @@ -4,7 +4,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "net/http" "os" "path/filepath" @@ -59,7 +58,7 @@ func (c *InCommand) Run(destDir string, request InRequest) (InResponse, error) { if foundRelease.HTMLURL != nil && *foundRelease.HTMLURL != "" { urlPath := filepath.Join(destDir, "url") - err = ioutil.WriteFile(urlPath, []byte(*foundRelease.HTMLURL), 0644) + err = os.WriteFile(urlPath, []byte(*foundRelease.HTMLURL), 0644) if err != nil { return InResponse{}, err } @@ -67,7 +66,7 @@ func (c *InCommand) Run(destDir string, request InRequest) (InResponse, error) { if foundRelease.TagName != nil && *foundRelease.TagName != "" { tagPath := filepath.Join(destDir, "tag") - err = ioutil.WriteFile(tagPath, []byte(*foundRelease.TagName), 0644) + err = os.WriteFile(tagPath, []byte(*foundRelease.TagName), 0644) if err != nil { return InResponse{}, err } @@ -78,7 +77,7 @@ func (c *InCommand) Run(destDir string, request InRequest) (InResponse, error) { } version := versionParser.parse(*foundRelease.TagName) versionPath := filepath.Join(destDir, "version") - err = ioutil.WriteFile(versionPath, []byte(version), 0644) + err = os.WriteFile(versionPath, []byte(version), 0644) if err != nil { return InResponse{}, err } @@ -91,7 +90,7 @@ func (c *InCommand) Run(destDir string, request InRequest) (InResponse, error) { } if commitSHA != "" { - err = ioutil.WriteFile(commitPath, []byte(commitSHA), 0644) + err = os.WriteFile(commitPath, []byte(commitSHA), 0644) if err != nil { return InResponse{}, err } @@ -101,7 +100,7 @@ func (c *InCommand) Run(destDir string, request InRequest) (InResponse, error) { if foundRelease.Body != nil && *foundRelease.Body != "" { body := *foundRelease.Body bodyPath := filepath.Join(destDir, "body") - err = ioutil.WriteFile(bodyPath, []byte(body), 0644) + err = os.WriteFile(bodyPath, []byte(body), 0644) if err != nil { return InResponse{}, err } @@ -113,7 +112,7 @@ func (c *InCommand) Run(destDir string, request InRequest) (InResponse, error) { if err != nil { return InResponse{}, err } - err = ioutil.WriteFile(timestampPath, timestamp, 0644) + err = os.WriteFile(timestampPath, timestamp, 0644) if err != nil { return InResponse{}, err } diff --git a/in_command_test.go b/in_command_test.go index ef82b9e..a7c412e 100644 --- a/in_command_test.go +++ b/in_command_test.go @@ -3,7 +3,7 @@ package resource_test import ( "bytes" "errors" - "io/ioutil" + "io" "net/http" "net/url" "os" @@ -40,14 +40,14 @@ var _ = Describe("In Command", func() { githubClient = &fakes.FakeGitHub{} githubServer = ghttp.NewServer() - command = resource.NewInCommand(githubClient, ioutil.Discard) + command = resource.NewInCommand(githubClient, io.Discard) - tmpDir, err = ioutil.TempDir("", "github-release") + tmpDir, err = os.MkdirTemp("", "github-release") Ω(err).ShouldNot(HaveOccurred()) destDir = filepath.Join(tmpDir, "destination") - githubClient.DownloadReleaseAssetReturns(ioutil.NopCloser(bytes.NewBufferString("some-content")), nil) + githubClient.DownloadReleaseAssetReturns(io.NopCloser(bytes.NewBufferString("some-content")), nil) inRequest = resource.InRequest{} }) @@ -167,27 +167,27 @@ var _ = Describe("In Command", func() { It("does create the body, tag, version, and url files", func() { inResponse, inErr = command.Run(destDir, inRequest) - contents, err := ioutil.ReadFile(path.Join(destDir, "tag")) + contents, err := os.ReadFile(path.Join(destDir, "tag")) Ω(err).ShouldNot(HaveOccurred()) Ω(string(contents)).Should(Equal("v0.35.0")) - contents, err = ioutil.ReadFile(path.Join(destDir, "version")) + contents, err = os.ReadFile(path.Join(destDir, "version")) Ω(err).ShouldNot(HaveOccurred()) Ω(string(contents)).Should(Equal("0.35.0")) - contents, err = ioutil.ReadFile(path.Join(destDir, "commit_sha")) + contents, err = os.ReadFile(path.Join(destDir, "commit_sha")) Ω(err).ShouldNot(HaveOccurred()) Ω(string(contents)).Should(Equal("f28085a4a8f744da83411f5e09fd7b1709149eee")) - contents, err = ioutil.ReadFile(path.Join(destDir, "body")) + contents, err = os.ReadFile(path.Join(destDir, "body")) Ω(err).ShouldNot(HaveOccurred()) Ω(string(contents)).Should(Equal("*markdown*")) - contents, err = ioutil.ReadFile(path.Join(destDir, "timestamp")) + contents, err = os.ReadFile(path.Join(destDir, "timestamp")) Ω(err).ShouldNot(HaveOccurred()) Ω(string(contents)).Should(Equal("2018-01-01T00:00:00Z")) - contents, err = ioutil.ReadFile(path.Join(destDir, "url")) + contents, err = os.ReadFile(path.Join(destDir, "url")) Ω(err).ShouldNot(HaveOccurred()) Ω(string(contents)).Should(Equal("http://google.com")) }) @@ -211,15 +211,15 @@ var _ = Describe("In Command", func() { It("does create the tag, version, and url files", func() { inResponse, inErr = command.Run(destDir, inRequest) - contents, err := ioutil.ReadFile(path.Join(destDir, "tag")) + contents, err := os.ReadFile(path.Join(destDir, "tag")) Ω(err).ShouldNot(HaveOccurred()) Ω(string(contents)).Should(Equal("package-0.35.0")) - contents, err = ioutil.ReadFile(path.Join(destDir, "version")) + contents, err = os.ReadFile(path.Join(destDir, "version")) Ω(err).ShouldNot(HaveOccurred()) Ω(string(contents)).Should(Equal("0.35.0")) - contents, err = ioutil.ReadFile(path.Join(destDir, "url")) + contents, err = os.ReadFile(path.Join(destDir, "url")) Ω(err).ShouldNot(HaveOccurred()) Ω(string(contents)).Should(Equal("http://google.com")) }) @@ -265,7 +265,7 @@ var _ = Describe("In Command", func() { It("saves the source tarball in the destination directory", func() { inResponse, inErr = command.Run(destDir, inRequest) - fileContents, err := ioutil.ReadFile(filepath.Join(destDir, "source.tar.gz")) + fileContents, err := os.ReadFile(filepath.Join(destDir, "source.tar.gz")) fContents := string(fileContents) Expect(err).NotTo(HaveOccurred()) Expect(fContents).To(Equal("source-tar-file-contents")) @@ -275,7 +275,7 @@ var _ = Describe("In Command", func() { inRequest.Source.AssetDir = true inResponse, inErr = command.Run(destDir, inRequest) - fileContents, err := ioutil.ReadFile(filepath.Join(destDir, "assets", "source.tar.gz")) + fileContents, err := os.ReadFile(filepath.Join(destDir, "assets", "source.tar.gz")) fContents := string(fileContents) Expect(err).NotTo(HaveOccurred()) Expect(fContents).To(Equal("source-tar-file-contents")) @@ -355,7 +355,7 @@ var _ = Describe("In Command", func() { It("saves the source zip in the destination directory", func() { inResponse, inErr = command.Run(destDir, inRequest) - fileContents, err := ioutil.ReadFile(filepath.Join(destDir, "source.zip")) + fileContents, err := os.ReadFile(filepath.Join(destDir, "source.zip")) fContents := string(fileContents) Expect(err).NotTo(HaveOccurred()) Expect(fContents).To(Equal("source-zip-file-contents")) @@ -365,7 +365,7 @@ var _ = Describe("In Command", func() { inRequest.Source.AssetDir = true inResponse, inErr = command.Run(destDir, inRequest) - fileContents, err := ioutil.ReadFile(filepath.Join(destDir, "assets", "source.zip")) + fileContents, err := os.ReadFile(filepath.Join(destDir, "assets", "source.zip")) fContents := string(fileContents) Expect(err).NotTo(HaveOccurred()) Expect(fContents).To(Equal("source-zip-file-contents")) @@ -525,15 +525,15 @@ var _ = Describe("In Command", func() { }) It("does create the tag, version, and URL files", func() { - contents, err := ioutil.ReadFile(path.Join(destDir, "tag")) + contents, err := os.ReadFile(path.Join(destDir, "tag")) Ω(err).ShouldNot(HaveOccurred()) Ω(string(contents)).Should(Equal("v0.35.0")) - contents, err = ioutil.ReadFile(path.Join(destDir, "version")) + contents, err = os.ReadFile(path.Join(destDir, "version")) Ω(err).ShouldNot(HaveOccurred()) Ω(string(contents)).Should(Equal("0.35.0")) - contents, err = ioutil.ReadFile(path.Join(destDir, "url")) + contents, err = os.ReadFile(path.Join(destDir, "url")) Ω(err).ShouldNot(HaveOccurred()) Ω(string(contents)).Should(Equal("http://google.com")) }) @@ -572,7 +572,7 @@ var _ = Describe("In Command", func() { }) It("does create the url file", func() { - contents, err := ioutil.ReadFile(path.Join(destDir, "url")) + contents, err := os.ReadFile(path.Join(destDir, "url")) Ω(err).ShouldNot(HaveOccurred()) Ω(string(contents)).Should(Equal("http://google.com")) }) @@ -610,7 +610,7 @@ var _ = Describe("In Command", func() { }) It("does create the url file", func() { - contents, err := ioutil.ReadFile(path.Join(destDir, "url")) + contents, err := os.ReadFile(path.Join(destDir, "url")) Ω(err).ShouldNot(HaveOccurred()) Ω(string(contents)).Should(Equal("http://google.com")) }) diff --git a/out_command.go b/out_command.go index ea44012..64ae978 100644 --- a/out_command.go +++ b/out_command.go @@ -3,7 +3,6 @@ package resource import ( "fmt" "io" - "io/ioutil" "os" "path/filepath" "strings" @@ -153,7 +152,7 @@ func (c *OutCommand) Run(sourceDir string, request OutRequest) (OutResponse, err } func (c *OutCommand) fileContents(path string) (string, error) { - contents, err := ioutil.ReadFile(path) + contents, err := os.ReadFile(path) if err != nil { return "", err } @@ -167,7 +166,7 @@ func (c *OutCommand) upload(release *github.RepositoryRelease, filePath string) name := filepath.Base(filePath) var retryErr error - for i := 0; i < 10; i++ { + for range 10 { file, err := os.Open(filePath) if err != nil { return err diff --git a/out_command_test.go b/out_command_test.go index 2da1bce..26c5fbf 100644 --- a/out_command_test.go +++ b/out_command_test.go @@ -2,7 +2,7 @@ package resource_test import ( "errors" - "io/ioutil" + "io" "os" "path/filepath" @@ -16,7 +16,7 @@ import ( ) func file(path, contents string) { - Ω(ioutil.WriteFile(path, []byte(contents), 0644)).Should(Succeed()) + Ω(os.WriteFile(path, []byte(contents), 0644)).Should(Succeed()) } var _ = Describe("Out Command", func() { @@ -33,9 +33,9 @@ var _ = Describe("Out Command", func() { var err error githubClient = &fakes.FakeGitHub{} - command = resource.NewOutCommand(githubClient, ioutil.Discard) + command = resource.NewOutCommand(githubClient, io.Discard) - sourcesDir, err = ioutil.TempDir("", "github-release") + sourcesDir, err = os.MkdirTemp("", "github-release") Ω(err).ShouldNot(HaveOccurred()) githubClient.CreateReleaseStub = func(gh github.RepositoryRelease) (*github.RepositoryRelease, error) { @@ -514,7 +514,7 @@ var _ = Describe("Out Command", func() { }, nil) githubClient.UploadReleaseAssetStub = func(rel github.RepositoryRelease, name string, file *os.File) error { - Expect(ioutil.ReadAll(file)).To(Equal([]byte("matching"))) + Expect(io.ReadAll(file)).To(Equal([]byte("matching"))) Expect(existingAsset).To(BeFalse()) existingAsset = true return errors.New("some-error") diff --git a/resource_suite_test.go b/resource_suite_test.go index ef4924e..ae14e55 100644 --- a/resource_suite_test.go +++ b/resource_suite_test.go @@ -9,8 +9,6 @@ import ( "github.com/google/go-github/v66/github" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - - _ "github.com/maxbrunsfeld/counterfeiter/v6" ) func TestGithubReleaseResource(t *testing.T) { @@ -62,7 +60,7 @@ func newRepositoryReleaseWithCreatedTime(id int, version string, day int) *githu Draft: github.Bool(false), Prerelease: github.Bool(false), ID: github.Int64(int64(id)), - CreatedAt: &github.Timestamp{exampleTimeStamp(day)}, + CreatedAt: &github.Timestamp{Time: exampleTimeStamp(day)}, } } @@ -72,7 +70,7 @@ func newRepositoryReleaseWithPublishedTime(id int, version string, day int) *git Draft: github.Bool(false), Prerelease: github.Bool(false), ID: github.Int64(int64(id)), - PublishedAt: &github.Timestamp{exampleTimeStamp(day)}, + PublishedAt: &github.Timestamp{Time: exampleTimeStamp(day)}, } } @@ -82,8 +80,8 @@ func newRepositoryReleaseWithCreatedAndPublishedTime(id int, version string, cre Draft: github.Bool(false), Prerelease: github.Bool(false), ID: github.Int64(int64(id)), - CreatedAt: &github.Timestamp{exampleTimeStamp(createdDay)}, - PublishedAt: &github.Timestamp{exampleTimeStamp(publishedDay)}, + CreatedAt: &github.Timestamp{Time: exampleTimeStamp(createdDay)}, + PublishedAt: &github.Timestamp{Time: exampleTimeStamp(publishedDay)}, } } diff --git a/tools.go b/tools.go new file mode 100644 index 0000000..18ef4d5 --- /dev/null +++ b/tools.go @@ -0,0 +1,10 @@ +//go:build tools + +package resource + +import ( + _ "github.com/maxbrunsfeld/counterfeiter/v6" +) + +// This file imports packages that are used when running go generate, or used +// during the development process but not otherwise depended on by built code.