chore: update CI, dependencies, and linter

This commit is contained in:
Ludovic Fernandez
2024-05-07 17:36:04 +02:00
committed by GitHub
parent a7324d7c32
commit d587761399
7 changed files with 27 additions and 23 deletions

View File

@ -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 }}

View File

@ -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 }}

View File

@ -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 }}

View File

@ -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'

6
app.go
View File

@ -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)

6
go.mod
View File

@ -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

6
go.sum
View File

@ -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=