diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d1379ec..7642e13 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,33 +12,20 @@ jobs: name: Main Process runs-on: ubuntu-latest env: - GO_VERSION: '1.20' - GOLANGCI_LINT_VERSION: v1.52.2 + GO_VERSION: stable + GOLANGCI_LINT_VERSION: v1.56.2 CGO_ENABLED: 0 steps: + # https://github.com/marketplace/actions/checkout + - name: Check out code + uses: actions/checkout@v4 # https://github.com/marketplace/actions/setup-go-environment - name: Set up Go ${{ env.GO_VERSION }} - uses: actions/setup-go@v2 + uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} - - # https://github.com/marketplace/actions/checkout - - name: Check out code - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - # https://github.com/marketplace/actions/cache - - name: Cache Go modules - uses: actions/cache@v3 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - name: Check and get dependencies run: | go mod download diff --git a/.github/workflows/go-cross.yml b/.github/workflows/go-cross.yml index 62e7362..0ea2c11 100644 --- a/.github/workflows/go-cross.yml +++ b/.github/workflows/go-cross.yml @@ -16,37 +16,19 @@ jobs: strategy: matrix: - go-version: [ '1.19', 1.x ] + go-version: [ stable, oldstable ] os: [ubuntu-latest, macos-latest, windows-latest] steps: - # https://github.com/marketplace/actions/setup-go-environment - - name: Set up Go ${{ matrix.go-version }} - uses: actions/setup-go@v2 - with: - go-version: ${{ matrix.go-version }} - # https://github.com/marketplace/actions/checkout - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - # https://github.com/marketplace/actions/cache - - name: Cache Go modules - uses: actions/cache@v3 + # https://github.com/marketplace/actions/setup-go-environment + - name: Set up Go ${{ matrix.go-version }} + uses: actions/setup-go@v5 with: - # In order: - # * Module download cache - # * Build cache (Linux) - # * Build cache (Mac) - # * Build cache (Windows) - path: | - ~/go/pkg/mod - ~/.cache/go-build - ~/Library/Caches/go-build - %LocalAppData%\go-build - key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-${{ matrix.go-version }}-go- + go-version: ${{ matrix.go-version }} - name: Test run: go test -v -cover ./... diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index be07aed..7d769fd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,36 +9,27 @@ jobs: name: Release Process runs-on: ubuntu-latest env: - GO_VERSION: '1.20' + GO_VERSION: stable CGO_ENABLED: 0 steps: - - # https://github.com/marketplace/actions/setup-go-environment - - name: Set up Go ${{ env.GO_VERSION }} - uses: actions/setup-go@v2 - with: - go-version: ${{ env.GO_VERSION }} - # https://github.com/marketplace/actions/checkout - name: Check out code - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - # https://github.com/marketplace/actions/cache - - name: Cache Go modules - uses: actions/cache@v3 + # https://github.com/marketplace/actions/setup-go-environment + - name: Set up Go ${{ env.GO_VERSION }} + uses: actions/setup-go@v5 with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-release-${{ hashFiles('**/go.sum') }} - restore-keys: ${{ runner.os }}-go-release- + go-version: ${{ env.GO_VERSION }} # https://goreleaser.com/ci/actions/ - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v2 + uses: goreleaser/goreleaser-action@v5 with: version: latest - args: release --rm-dist + args: release --clean env: GITHUB_TOKEN: ${{ secrets.GH_TOKEN_REPO }} diff --git a/.golangci.yml b/.golangci.yml index 77ec35f..8823271 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -24,11 +24,13 @@ linters-settings: gofumpt: extra-rules: true depguard: - list-type: blacklist - include-go-root: false - packages: - - github.com/sirupsen/logrus - - github.com/pkg/errors + rules: + main: + deny: + - pkg: "github.com/instana/testify" + desc: not allowed + - pkg: "github.com/pkg/errors" + desc: Should be replaced by standard lib errors package gocritic: enabled-tags: - diagnostic @@ -90,8 +92,10 @@ linters: issues: exclude-use-default: false - max-per-linter: 0 + max-issues-per-linter: 0 max-same-issues: 0 + exclude: + - 'fmt.Sprintf can be replaced with string' exclude-rules: - path: .*_test.go linters: diff --git a/.goreleaser.yml b/.goreleaser.yml index 156b9ca..4588b96 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -44,7 +44,7 @@ archives: - LICENSE brews: - - tap: + - repository: owner: traefik name: homebrew-tap commit_author: diff --git a/go.mod b/go.mod index c622244..9ce066f 100644 --- a/go.mod +++ b/go.mod @@ -1,9 +1,9 @@ module github.com/traefik/mocktail -go 1.19 +go 1.21 require ( - github.com/ettle/strcase v0.1.1 + github.com/ettle/strcase v0.2.0 github.com/stretchr/testify v1.8.1 ) diff --git a/go.sum b/go.sum index 5ab6cb8..eb22b76 100644 --- a/go.sum +++ b/go.sum @@ -1,21 +1,19 @@ 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/ettle/strcase v0.1.1 h1:htFueZyVeE1XNnMEfbqp5r67qAN/4r6ya1ysq8Q+Zcw= -github.com/ettle/strcase v0.1.1/go.mod h1:hzDLsPC7/lwKyBOywSHEP89nt2pDgdy+No1NBA9o9VY= +github.com/ettle/strcase v0.2.0 h1:fGNiVF21fHXpX1niBgk0aROov1LagYsOwV/xqKDKR/Q= +github.com/ettle/strcase v0.2.0/go.mod h1:DajmHElDSaX76ITe3/VHVyMin4LWSJN5Z909Wp+ED1A= 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/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/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= 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.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= 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.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 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=