From 9e52ce611bce4cb2adb50bac1ef392d48002e10b Mon Sep 17 00:00:00 2001 From: Chris Sainty Date: Tue, 17 Oct 2023 10:00:33 +1100 Subject: [PATCH 1/2] Migrate over to uber-mainted fork of gomock --- .circleci/config.yml | 34 ----------------------------- .github/dependabot.yml | 17 +++++++++++++++ .github/workflows/ci.yaml | 45 +++++++++++++++++++++++++++++++++++++++ README.md | 1 - asyncblock.go | 2 +- asyncblock_test.go | 2 +- go.mod | 9 ++++++-- go.sum | 11 ++-------- proto.go | 2 +- recording.go | 2 +- recording_test.go | 2 +- 11 files changed, 76 insertions(+), 51 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/ci.yaml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 941e40b..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,34 +0,0 @@ -version: 2.1 - -orbs: - toolkit: storytel/toolkit@1 - -parameters: - go-version: - type: string - default: "1.19" - -workflows: - ci: - jobs: - - toolkit/go-ci: - context: gcloud-storytel-build - version: <> - revive: false - test_package: ./... - filters: - branches: - ignore: main - name: ci-pr-branch - sonarqube_mode: pr - - - toolkit/go-ci: - context: gcloud-storytel-build - version: <> - revive: false - test_package: ./... - filters: - branches: - only: main - name: ci-base-branch - sonarqube_mode: base \ No newline at end of file diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..0a77270 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,17 @@ +version: 2 +updates: + - package-ecosystem: gomod + directory: "/" + schedule: + interval: daily + time: "08:00" + reviewers: + - "Storytel/go" + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: daily + time: "08:00" + reviewers: + - "Storytel/go" diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..c331ea0 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,45 @@ +name: CI Pipeline + +on: + pull_request: + push: + branches: + - master + +permissions: + contents: read + +jobs: + ci: + name: CI + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 + + - name: Configure correct Go version + uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 + with: + go-version-file: go.mod + + # Check formatting early for a fast fail + - run: bash -c "diff -bu <(echo -n) <(gofmt -l ./)" + + - run: go build . + + - uses: dominikh/staticcheck-action@ba605356b4b29a60e87ab9404b712f3461e566dc # v1.3.0 + with: + install-go: false + + - run: go vet ./... + + - name: Run Tests + run: | + go install gotest.tools/gotestsum@latest + gotestsum --jsonfile gotestsum-report.json -- -race ./... + + - name: Annotate tests + if: always() + uses: guyarb/golang-test-annotations@a7869d394e8879bfc2e5dba4f1ea8bbb77a74f59 # v0.7.0 + with: + test-results: gotestsum-report.json \ No newline at end of file diff --git a/README.md b/README.md index c731f8f..600a8b7 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # Gomock Matcher [![CircleCI](https://circleci.com/gh/Storytel/gomock-matchers/tree/master.svg?style=svg)](https://circleci.com/gh/Storytel/gomock-matchers/tree/master) -[![Coverage Status](https://coveralls.io/repos/github/Storytel/gomock-matchers/badge.svg)](https://coveralls.io/github/Storytel/gomock-matchers) [![Go Report Card](https://goreportcard.com/badge/github.com/Storytel/gomock-matchers)](https://goreportcard.com/report/github.com/Storytel/gomock-matchers) Matching library for use with [golang/gomock][golang-gomock] diff --git a/asyncblock.go b/asyncblock.go index f6b3057..5d40dec 100644 --- a/asyncblock.go +++ b/asyncblock.go @@ -1,6 +1,6 @@ package matchers -import "github.com/golang/mock/gomock" +import "go.uber.org/mock/gomock" type AsyncBlockMatcher struct { matcher gomock.Matcher diff --git a/asyncblock_test.go b/asyncblock_test.go index 9004156..1e90967 100644 --- a/asyncblock_test.go +++ b/asyncblock_test.go @@ -4,8 +4,8 @@ import ( "testing" matchers "github.com/Storytel/gomock-matchers" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" + "go.uber.org/mock/gomock" ) func TestAsyncBlockMatcherPassthrough(t *testing.T) { diff --git a/go.mod b/go.mod index b78c6e6..b43e5b9 100644 --- a/go.mod +++ b/go.mod @@ -1,9 +1,14 @@ module github.com/Storytel/gomock-matchers -go 1.15 +go 1.21 require ( - github.com/golang/mock v1.2.1-0.20190311213431-837231f7bb37 github.com/stretchr/testify v1.3.0 google.golang.org/protobuf v1.31.0 ) + +require ( + github.com/davecgh/go-spew v1.1.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + go.uber.org/mock v0.3.0 +) diff --git a/go.sum b/go.sum index 6c83f7e..28334cb 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,5 @@ 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/golang/mock v1.2.1-0.20190311213431-837231f7bb37 h1:X/VEzS/ARNAir3sehGjZ/MT66dlHovEDk3Cr8BDm4oA= -github.com/golang/mock v1.2.1-0.20190311213431-837231f7bb37/go.mod h1:L3bP22mxdfCUHSUVMs+SPJMx55FrxQew7MSXT11Q86g= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -11,14 +8,10 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20190221204921-83362c3779f5/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +go.uber.org/mock v0.3.0 h1:3mUxI1No2/60yUYax92Pt8eNOEecx2D3lcXZh2NEZJo= +go.uber.org/mock v0.3.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= diff --git a/proto.go b/proto.go index 963329b..38417ff 100644 --- a/proto.go +++ b/proto.go @@ -3,7 +3,7 @@ package matchers import ( "encoding/json" - "github.com/golang/mock/gomock" + "go.uber.org/mock/gomock" "google.golang.org/protobuf/proto" ) diff --git a/recording.go b/recording.go index 0b4e582..b0efa6d 100644 --- a/recording.go +++ b/recording.go @@ -1,6 +1,6 @@ package matchers -import "github.com/golang/mock/gomock" +import "go.uber.org/mock/gomock" type RecordMatcher struct { x interface{} diff --git a/recording_test.go b/recording_test.go index c14e015..4b8dac4 100644 --- a/recording_test.go +++ b/recording_test.go @@ -4,8 +4,8 @@ import ( "testing" matchers "github.com/Storytel/gomock-matchers" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" + "go.uber.org/mock/gomock" ) func TestRecordMatcherPassthrough(t *testing.T) { From 1028d7279cb34d4f9b1aecf5967529d9ce4dd222 Mon Sep 17 00:00:00 2001 From: Chris Sainty Date: Tue, 17 Oct 2023 10:09:41 +1100 Subject: [PATCH 2/2] Correct README links --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 600a8b7..2bf8876 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ # Gomock Matcher -[![CircleCI](https://circleci.com/gh/Storytel/gomock-matchers/tree/master.svg?style=svg)](https://circleci.com/gh/Storytel/gomock-matchers/tree/master) [![Go Report Card](https://goreportcard.com/badge/github.com/Storytel/gomock-matchers)](https://goreportcard.com/report/github.com/Storytel/gomock-matchers) Matching library for use with [golang/gomock][golang-gomock] @@ -128,5 +127,5 @@ func TestAsyncBlockMatcher(t *testing.T) { ``` -[matcher-interface]: https://godoc.org/github.com/golang/mock/gomock#Matcher -[golang-gomock]: https://github.com/golang/mock +[matcher-interface]: https://godoc.org/go.uber.org/mock/gomock#Matcher +[golang-gomock]: https://github.com/uber-go/mock \ No newline at end of file