From 7b8af80e0f32e0051a4a06bed4745c7f2156fb21 Mon Sep 17 00:00:00 2001 From: Shugo Kawamura Date: Fri, 13 Sep 2024 01:40:32 +0900 Subject: [PATCH 1/9] Update Go. --- .github/workflows/go-cross.yml | 2 +- .github/workflows/main.yml | 2 +- go.mod | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/go-cross.yml b/.github/workflows/go-cross.yml index 6e2b2e4..8f7e871 100644 --- a/.github/workflows/go-cross.yml +++ b/.github/workflows/go-cross.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: - go-version: [ 1.19, 1.x ] + go-version: [ 1.23, 1.x ] os: [ubuntu-latest, macos-latest, windows-latest] steps: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 025a3d1..0302f00 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,7 +12,7 @@ jobs: name: Main Process runs-on: ubuntu-latest env: - GO_VERSION: 1.19 + GO_VERSION: 1.23 GOLANGCI_LINT_VERSION: v1.50.0 YAEGI_VERSION: v0.14.2 CGO_ENABLED: 0 diff --git a/go.mod b/go.mod index 38181bb..02ae1cf 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,5 @@ module github.com/traefik/plugindemo -go 1.19 +go 1.23 + +toolchain go1.23.1 From 5f7788442ee100849807c4068297282cc58f01bf Mon Sep 17 00:00:00 2001 From: Shugo Kawamura Date: Fri, 13 Sep 2024 01:45:42 +0900 Subject: [PATCH 2/9] Update golangci-lint / yaegi --- .github/workflows/main.yml | 4 ++-- .golangci.yml | 15 ++------------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0302f00..d90831a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,8 +13,8 @@ jobs: runs-on: ubuntu-latest env: GO_VERSION: 1.23 - GOLANGCI_LINT_VERSION: v1.50.0 - YAEGI_VERSION: v0.14.2 + GOLANGCI_LINT_VERSION: v1.61.1 + YAEGI_VERSION: v0.16.1 CGO_ENABLED: 0 defaults: run: 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 From 85fef272bf2d0074ce786aeb54cbada6251e0b27 Mon Sep 17 00:00:00 2001 From: Shugo Kawamura Date: Fri, 13 Sep 2024 01:47:06 +0900 Subject: [PATCH 3/9] replace fmt.Errorf with errors.New --- demo.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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{ From 7cc33a992228fb7bd27e796f3e08f33ce4ba6663 Mon Sep 17 00:00:00 2001 From: FlowingSPDG Date: Fri, 13 Sep 2024 04:27:45 +0900 Subject: [PATCH 4/9] Apply suggestions from code review Apply suggestions Co-authored-by: Ludovic Fernandez --- .github/workflows/go-cross.yml | 2 +- .github/workflows/main.yml | 4 ++-- go.mod | 4 +--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/go-cross.yml b/.github/workflows/go-cross.yml index 8f7e871..6137778 100644 --- a/.github/workflows/go-cross.yml +++ b/.github/workflows/go-cross.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: - go-version: [ 1.23, 1.x ] + go-version: [ oldstable, stable ] os: [ubuntu-latest, macos-latest, windows-latest] steps: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d90831a..1d7206b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,8 +12,8 @@ jobs: name: Main Process runs-on: ubuntu-latest env: - GO_VERSION: 1.23 - GOLANGCI_LINT_VERSION: v1.61.1 + GO_VERSION: stable + GOLANGCI_LINT_VERSION: v1.61.0 YAEGI_VERSION: v0.16.1 CGO_ENABLED: 0 defaults: diff --git a/go.mod b/go.mod index 02ae1cf..559d8ca 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,3 @@ module github.com/traefik/plugindemo -go 1.23 - -toolchain go1.23.1 +go 1.22.0 From db60eba23cf607c4fef040b5e6f0210f48620be7 Mon Sep 17 00:00:00 2001 From: Shugo Kawamura Date: Fri, 13 Sep 2024 23:31:47 +0900 Subject: [PATCH 5/9] Fix go matrix actions --- .github/workflows/go-cross.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/go-cross.yml b/.github/workflows/go-cross.yml index 6137778..abe89dc 100644 --- a/.github/workflows/go-cross.yml +++ b/.github/workflows/go-cross.yml @@ -13,13 +13,15 @@ jobs: matrix: go-version: [ oldstable, stable ] os: [ubuntu-latest, macos-latest, windows-latest] + arch: ['x32', 'x64'] steps: # https://github.com/marketplace/actions/setup-go-environment - - name: Set up Go ${{ matrix.go-version }} - uses: actions/setup-go@v2 + - name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}(${{ matrix.arch }}) + uses: actions/setup-go@v5 with: go-version: ${{ matrix.go-version }} + architecture: ${{ matrix.arch }} # https://github.com/marketplace/actions/checkout - name: Checkout code @@ -39,9 +41,9 @@ jobs: ~/.cache/go-build ~/Library/Caches/go-build %LocalAppData%\go-build - key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }} + key: ${{ runner.os }}-${{ matrix.arch }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }} restore-keys: | - ${{ runner.os }}-${{ matrix.go-version }}-go- + ${{ runner.os }}-${{ matrix.arch }}-${{ matrix.go-version }}-go- - name: Test run: go test -v -cover ./... From 3e5cec4bcb42f77db7fa60ad6ac3b8748a50df62 Mon Sep 17 00:00:00 2001 From: FlowingSPDG Date: Thu, 10 Oct 2024 15:17:42 +0000 Subject: [PATCH 6/9] Update actions --- .github/workflows/go-cross.yml | 27 ++------------------------- .github/workflows/main.yml | 25 ++++--------------------- 2 files changed, 6 insertions(+), 46 deletions(-) diff --git a/.github/workflows/go-cross.yml b/.github/workflows/go-cross.yml index abe89dc..b7d6d3b 100644 --- a/.github/workflows/go-cross.yml +++ b/.github/workflows/go-cross.yml @@ -16,34 +16,11 @@ jobs: arch: ['x32', 'x64'] steps: - # https://github.com/marketplace/actions/setup-go-environment - - name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}(${{ matrix.arch }}) - uses: actions/setup-go@v5 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: go-version: ${{ matrix.go-version }} architecture: ${{ matrix.arch }} - # 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.arch }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-${{ matrix.arch }}-${{ matrix.go-version }}-go- - - name: Test run: go test -v -cover ./... diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1d7206b..4156cab 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,28 +21,11 @@ jobs: 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 }} + architecture: ${{ matrix.arch }} # https://golangci-lint.run/usage/install#other-ci - name: Install golangci-lint ${{ env.GOLANGCI_LINT_VERSION }} From 66a0999cf29889418505ab861cda8e9fe1089bca Mon Sep 17 00:00:00 2001 From: FlowingSPDG Date: Sun, 13 Oct 2024 01:50:53 +0900 Subject: [PATCH 7/9] Update .github/workflows/main.yml Co-authored-by: Ludovic Fernandez --- .github/workflows/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4156cab..9971cbb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,7 +25,6 @@ jobs: - uses: actions/setup-go@v5 with: go-version: ${{ matrix.go-version }} - architecture: ${{ matrix.arch }} # https://golangci-lint.run/usage/install#other-ci - name: Install golangci-lint ${{ env.GOLANGCI_LINT_VERSION }} From 029f49e6dde9b9eff7b6f1237dd12537e98126c2 Mon Sep 17 00:00:00 2001 From: FlowingSPDG Date: Sun, 13 Oct 2024 01:51:04 +0900 Subject: [PATCH 8/9] Update .github/workflows/go-cross.yml Co-authored-by: Ludovic Fernandez --- .github/workflows/go-cross.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/go-cross.yml b/.github/workflows/go-cross.yml index b7d6d3b..04a5aa8 100644 --- a/.github/workflows/go-cross.yml +++ b/.github/workflows/go-cross.yml @@ -13,7 +13,6 @@ jobs: matrix: go-version: [ oldstable, stable ] os: [ubuntu-latest, macos-latest, windows-latest] - arch: ['x32', 'x64'] steps: - uses: actions/checkout@v4 From 95c52e84c7bb8ed27c329b8a55a88f9ba627701a Mon Sep 17 00:00:00 2001 From: FlowingSPDG Date: Sun, 13 Oct 2024 01:51:13 +0900 Subject: [PATCH 9/9] Update .github/workflows/go-cross.yml Co-authored-by: Ludovic Fernandez --- .github/workflows/go-cross.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/go-cross.yml b/.github/workflows/go-cross.yml index 04a5aa8..eb8401c 100644 --- a/.github/workflows/go-cross.yml +++ b/.github/workflows/go-cross.yml @@ -19,7 +19,6 @@ jobs: - uses: actions/setup-go@v5 with: go-version: ${{ matrix.go-version }} - architecture: ${{ matrix.arch }} - name: Test run: go test -v -cover ./...