chore: update Go, linter, CI

This commit is contained in:
Fernandez Ludovic
2022-09-10 12:29:58 +02:00
parent 2d6ebedb0f
commit 9b1db3f461
7 changed files with 74 additions and 30 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

5
app.go
View File

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

2
go.mod
View File

@ -1,5 +1,5 @@
module github.com/traefik/whoami
go 1.17
go 1.19
require github.com/gorilla/websocket v1.4.2