diff --git a/.github/workflows/main.yml b/.github/workflows/ci.yml similarity index 95% rename from .github/workflows/main.yml rename to .github/workflows/ci.yml index 61e3f4c..4935096 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/ci.yml @@ -12,8 +12,8 @@ jobs: name: Main Process runs-on: ubuntu-latest env: - GO_VERSION: 1.17 - GOLANGCI_LINT_VERSION: v1.46.2 + GO_VERSION: 1.19 + GOLANGCI_LINT_VERSION: v1.49.0 CGO_ENABLED: 0 steps: diff --git a/.github/workflows/go-cross.yml b/.github/workflows/go-cross.yml index 02f4723..7780d30 100644 --- a/.github/workflows/go-cross.yml +++ b/.github/workflows/go-cross.yml @@ -15,7 +15,7 @@ jobs: strategy: matrix: - go-version: [ 1.17, 1.x ] + go-version: [ 1.19, 1.x ] os: [ubuntu-latest, macos-latest, windows-latest] steps: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 914a7c7..d330d8d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,7 @@ jobs: name: Release Process runs-on: ubuntu-latest env: - GO_VERSION: 1.17 + GO_VERSION: 1.19 SEIHON_VERSION: v0.9.0 CGO_ENABLED: 0 diff --git a/.golangci.yml b/.golangci.yml index 1713c7b..5b01fb3 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,48 +1,93 @@ run: - deadline: 2m + timeout: 2m skip-files: [] + linters-settings: govet: - check-shadowing: true + enable-all: true + disable: + - fieldalignment gocyclo: - min-complexity: 12 + min-complexity: 16 goconst: min-len: 3 min-occurrences: 3 misspell: locale: US + funlen: + lines: -1 + statements: 40 + gofumpt: + extra-rules: true + depguard: + list-type: blacklist + include-go-root: false + packages: + - github.com/pkg/errors + godox: + keywords: + - FIXME + gocritic: + enabled-tags: + - diagnostic + - style + - performance + disabled-checks: + - sloppyReassign + - rangeValCopy + - octalLiteral + - paramTypeCombine # already handle by gofumpt.extra-rules + settings: + hugeParam: + sizeThreshold: 100 + forbidigo: + forbid: + - '^print(ln)?$' + - '^panic$' + - '^spew\.Print(f|ln)?$' + - '^spew\.Dump$' linters: enable-all: true disable: + - deadcode # deprecated + - exhaustivestruct # deprecated - golint # deprecated - - scopelint # deprecated + - ifshort # deprecated - interfacer # deprecated - maligned # deprecated - - lll - - gosec + - nosnakecase # deprecated + - scopelint # deprecated + - scopelint # deprecated + - structcheck # deprecated + - varcheck # deprecated + - execinquery # not relevant (SQL) + - rowserrcheck # not relevant (SQL) + - sqlclosecheck # not relevant (SQL) + - cyclop # duplicate of gocyclo - dupl - - prealloc + - exhaustive + - exhaustruct + - forbidigo - gochecknoglobals - gochecknoinits - - gomnd - - wsl - - nlreturn - - testpackage - - paralleltest - - tparallel - goerr113 - - wrapcheck - - exhaustive - - exhaustivestruct - - forbidigo - - varnamelen + - gomnd + - gosec + - lll - nilnil - - ifshort - - exhaustruct + - nlreturn + - paralleltest + - prealloc + - testpackage + - tparallel + - varnamelen + - wrapcheck + - wsl issues: exclude-use-default: false max-per-linter: 0 max-same-issues: 0 - exclude: [] + exclude: + - 'package-comments: should have a package comment' diff --git a/Makefile b/Makefile index 74267cc..3f4eabd 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: default build image check publish-images +.PHONY: default check test build image publish-images TAG_NAME := $(shell git tag -l --contains HEAD) diff --git a/app.go b/app.go index 965c213..a852d54 100644 --- a/app.go +++ b/app.go @@ -7,7 +7,6 @@ import ( "flag" "fmt" "io" - "io/ioutil" "log" "net" "net/http" @@ -85,7 +84,7 @@ func main() { } func setupMutualTLS(ca string) *tls.Config { - clientCACert, err := ioutil.ReadFile(ca) + clientCACert, err := os.ReadFile(ca) if err != nil { log.Fatal(err) } @@ -312,7 +311,7 @@ func healthHandler(w http.ResponseWriter, req *http.Request) { func getEnv(key, fallback string) string { value := os.Getenv(key) - if len(value) == 0 { + if value == "" { return fallback } return value diff --git a/go.mod b/go.mod index 4a3d377..bd95bb5 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,5 @@ module github.com/traefik/whoami -go 1.17 +go 1.19 require github.com/gorilla/websocket v1.4.2