diff --git a/.github/workflows/go-cross.yml b/.github/workflows/go-cross.yml index 6e2b2e4..192528e 100644 --- a/.github/workflows/go-cross.yml +++ b/.github/workflows/go-cross.yml @@ -11,23 +11,23 @@ jobs: strategy: matrix: - go-version: [ 1.19, 1.x ] + go-version: [ 1.22, 1.x ] 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/setup-go@v5 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 + uses: actions/cache@v4 with: # In order: # * Module download cache diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 025a3d1..6575f6c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,9 +12,9 @@ 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: 1.22 + GOLANGCI_LINT_VERSION: v1.58.1 + YAEGI_VERSION: v0.16.1 CGO_ENABLED: 0 defaults: run: @@ -24,20 +24,20 @@ jobs: # 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 + uses: actions/checkout@v4 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/cache@v4 with: path: ${{ github.workspace }}/go/pkg/mod key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} diff --git a/.traefik.yml b/.traefik.yml index 57fb70e..65503ef 100644 --- a/.traefik.yml +++ b/.traefik.yml @@ -2,7 +2,7 @@ displayName: Demo Plugin type: middleware iconPath: .assets/icon.png -import: github.com/traefik/plugindemo +import: github.com/argyle-engineering/traefik-ratelimiter-middleware summary: '[Demo] Add Request Header' diff --git a/demo.go b/demo.go index 88d8c18..cbfa3c4 100644 --- a/demo.go +++ b/demo.go @@ -4,7 +4,7 @@ package plugindemo import ( "bytes" "context" - "fmt" + "errors" "net/http" "text/template" ) @@ -30,9 +30,9 @@ type Demo struct { } // New created a new Demo plugin. -func New(ctx context.Context, next http.Handler, config *Config, name string) (http.Handler, error) { +func New(_ 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/demo_test.go b/demo_test.go index dd0edcf..1c2e0fb 100644 --- a/demo_test.go +++ b/demo_test.go @@ -1,16 +1,14 @@ -package plugindemo_test +package plugindemo import ( "context" "net/http" "net/http/httptest" "testing" - - "github.com/traefik/plugindemo" ) func TestDemo(t *testing.T) { - cfg := plugindemo.CreateConfig() + cfg := CreateConfig() cfg.Headers["X-Host"] = "[[.Host]]" cfg.Headers["X-Method"] = "[[.Method]]" cfg.Headers["X-URL"] = "[[.URL]]" @@ -18,9 +16,9 @@ func TestDemo(t *testing.T) { cfg.Headers["X-Demo"] = "test" ctx := context.Background() - next := http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {}) + next := http.HandlerFunc(func(_ http.ResponseWriter, _ *http.Request) {}) - handler, err := plugindemo.New(ctx, next, cfg, "demo-plugin") + handler, err := New(ctx, next, cfg, "demo-plugin") if err != nil { t.Fatal(err) } diff --git a/go.mod b/go.mod index 38181bb..dbecb52 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ -module github.com/traefik/plugindemo +module github.com/argyle-engineering/traefik-ratelimiter-middleware -go 1.19 +go 1.22