diff --git a/.github/workflows/go-cross.yml b/.github/workflows/go-cross.yml index 6e2b2e4..eb8401c 100644 --- a/.github/workflows/go-cross.yml +++ b/.github/workflows/go-cross.yml @@ -11,37 +11,14 @@ jobs: strategy: matrix: - go-version: [ 1.19, 1.x ] + go-version: [ oldstable, stable ] 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 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: go-version: ${{ matrix.go-version }} - # https://github.com/marketplace/actions/checkout - - name: Checkout code - uses: actions/checkout@v2 - - # https://github.com/marketplace/actions/cache - - name: Cache Go modules - uses: actions/cache@v3 - 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- - - name: Test run: go test -v -cover ./... diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 025a3d1..9971cbb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,37 +12,19 @@ jobs: name: Main Process runs-on: ubuntu-latest env: - GO_VERSION: 1.19 - GOLANGCI_LINT_VERSION: v1.50.0 - YAEGI_VERSION: v0.14.2 + GO_VERSION: stable + GOLANGCI_LINT_VERSION: v1.61.0 + YAEGI_VERSION: v0.16.1 CGO_ENABLED: 0 defaults: run: working-directory: ${{ github.workspace }}/go/src/github.com/${{ github.repository }} 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 - with: - path: go/src/github.com/${{ github.repository }} - fetch-depth: 0 - - # https://github.com/marketplace/actions/cache - - name: Cache Go modules - uses: actions/cache@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: - path: ${{ github.workspace }}/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- + go-version: ${{ matrix.go-version }} # https://golangci-lint.run/usage/install#other-ci - name: Install golangci-lint ${{ env.GOLANGCI_LINT_VERSION }} diff --git a/.golangci.yml b/.golangci.yml index cc994d7..f3d3493 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -29,17 +29,7 @@ linters-settings: linters: enable-all: true disable: - - deadcode # deprecated - - exhaustivestruct # deprecated - - golint # deprecated - - ifshort # deprecated - - interfacer # deprecated - - maligned # deprecated - - nosnakecase # deprecated - - scopelint # deprecated - - scopelint # deprecated - - structcheck # deprecated - - varcheck # deprecated + - exportloopref # deprecated - sqlclosecheck # not relevant (SQL) - rowserrcheck # not relevant (SQL) - execinquery # not relevant (SQL) @@ -53,9 +43,8 @@ linters: - wsl - exhaustive - exhaustruct - - goerr113 + - err113 - wrapcheck - - ifshort - noctx - lll - gomnd diff --git a/demo.go b/demo.go index 88d8c18..5ab8cec 100644 --- a/demo.go +++ b/demo.go @@ -4,7 +4,7 @@ package plugindemo import ( "bytes" "context" - "fmt" + "errors" "net/http" "text/template" ) @@ -32,7 +32,7 @@ type Demo struct { // New created a new Demo plugin. func New(ctx context.Context, next http.Handler, config *Config, name string) (http.Handler, error) { if len(config.Headers) == 0 { - return nil, fmt.Errorf("headers cannot be empty") + return nil, errors.New("headers cannot be empty") } return &Demo{ diff --git a/go.mod b/go.mod index 38181bb..559d8ca 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module github.com/traefik/plugindemo -go 1.19 +go 1.22.0