Skip to content

Update Go version #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 3 additions & 26 deletions .github/workflows/go-cross.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ./...
30 changes: 6 additions & 24 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
15 changes: 2 additions & 13 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -53,9 +43,8 @@ linters:
- wsl
- exhaustive
- exhaustruct
- goerr113
- err113
- wrapcheck
- ifshort
- noctx
- lll
- gomnd
Expand Down
4 changes: 2 additions & 2 deletions demo.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package plugindemo
import (
"bytes"
"context"
"fmt"
"errors"
"net/http"
"text/template"
)
Expand Down Expand Up @@ -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{
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/traefik/plugindemo

go 1.19
go 1.22.0