From fba895b3b7c0a3888b0956dc59d94fb48f8d2f1b Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Tue, 7 May 2024 17:20:14 +0200 Subject: [PATCH] chore: update CI, dependencies, and linter --- .github/workflows/ci.yml | 6 +++--- .github/workflows/go-cross.yml | 4 ++-- .github/workflows/release.yml | 16 ++++++++-------- .golangci.yml | 6 +++--- app.go | 6 +++--- go.mod | 6 ++++-- go.sum | 6 ++++-- 7 files changed, 27 insertions(+), 23 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c9ca4bf..550de13 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,20 +13,20 @@ jobs: runs-on: ubuntu-latest env: GO_VERSION: stable - GOLANGCI_LINT_VERSION: v1.54.2 + GOLANGCI_LINT_VERSION: v1.58.0 CGO_ENABLED: 0 steps: # https://github.com/marketplace/actions/checkout - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 # https://github.com/marketplace/actions/setup-go-environment - name: Set up Go ${{ env.GO_VERSION }} - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} diff --git a/.github/workflows/go-cross.yml b/.github/workflows/go-cross.yml index 4405b89..87fcc5e 100644 --- a/.github/workflows/go-cross.yml +++ b/.github/workflows/go-cross.yml @@ -21,11 +21,11 @@ jobs: steps: # https://github.com/marketplace/actions/checkout - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 # https://github.com/marketplace/actions/setup-go-environment - name: Set up Go ${{ matrix.go-version }} - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: ${{ matrix.go-version }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 46883d7..982eea2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,40 +16,40 @@ jobs: # https://github.com/marketplace/actions/checkout - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 # https://github.com/marketplace/actions/setup-go-environment - name: Set up Go ${{ env.GO_VERSION }} - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} - name: dockerhub-login - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: ghcr-login - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: registry: ghcr.io username: traefiker password: ${{ secrets.GHCR_TOKEN }} - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 # 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 882b054..8958a23 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,6 +1,5 @@ run: timeout: 2m - skip-files: [] linters-settings: govet: @@ -74,7 +73,8 @@ linters: - forbidigo - gochecknoglobals - gochecknoinits - - goerr113 + - err113 + - mnd - gomnd - gosec - lll @@ -90,7 +90,7 @@ linters: issues: exclude-use-default: false - max-per-linter: 0 + max-issues-per-linter: 0 max-same-issues: 0 exclude: - 'package-comments: should have a package comment' diff --git a/app.go b/app.go index 49ce421..d7a0f17 100644 --- a/app.go +++ b/app.go @@ -31,7 +31,7 @@ const ( var upgrader = websocket.Upgrader{ ReadBufferSize: 1024, WriteBufferSize: 1024, - CheckOrigin: func(r *http.Request) bool { + CheckOrigin: func(_ *http.Request) bool { return true }, } @@ -89,7 +89,7 @@ func main() { Handler: mux, } - if len(ca) > 0 { + if ca != "" { server.TLSConfig = setupMutualTLS(ca) } @@ -211,7 +211,7 @@ func whoamiHandler(w http.ResponseWriter, r *http.Request) { queryParams := r.URL.Query() wait := queryParams.Get("wait") - if len(wait) > 0 { + if wait != "" { duration, err := time.ParseDuration(wait) if err == nil { time.Sleep(duration) diff --git a/go.mod b/go.mod index 872857e..1730b68 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,7 @@ module github.com/traefik/whoami -go 1.20 +go 1.21 -require github.com/gorilla/websocket v1.5.0 +require github.com/gorilla/websocket v1.5.1 + +require golang.org/x/net v0.25.0 // indirect diff --git a/go.sum b/go.sum index e5a03d4..b537248 100644 --- a/go.sum +++ b/go.sum @@ -1,2 +1,4 @@ -github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= -github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= +github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= +golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=