From 027251a22b3ebc9d4718a4f7285e27ae35287a0f Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Mon, 15 Jul 2024 16:04:16 +0200 Subject: [PATCH] chore: update linter, dependencies, and CI --- .github/workflows/ci.yml | 15 ++++----------- .github/workflows/go-cross.yml | 9 ++------- .golangci.yml | 26 +++++++++----------------- go.mod | 4 ++-- go.sum | 8 ++++---- 5 files changed, 21 insertions(+), 41 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6db9d01..dd05aaf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,6 +4,7 @@ on: push: branches: - master + - main pull_request: jobs: @@ -13,20 +14,12 @@ jobs: runs-on: ubuntu-latest env: GO_VERSION: stable - GOLANGCI_LINT_VERSION: v1.56.1 + GOLANGCI_LINT_VERSION: v1.59.1 CGO_ENABLED: 0 steps: - - # https://github.com/marketplace/actions/checkout - - name: Check out code - 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@v5 + - uses: actions/checkout@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 52677c7..8ea99af 100644 --- a/.github/workflows/go-cross.yml +++ b/.github/workflows/go-cross.yml @@ -15,13 +15,8 @@ jobs: os: [ubuntu-latest, macos-latest, windows-latest] steps: - # https://github.com/marketplace/actions/checkout - - name: Checkout code - uses: actions/checkout@v4 - - # https://github.com/marketplace/actions/setup-go-environment - - name: Set up Go ${{ matrix.go-version }} - uses: actions/setup-go@v5 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: go-version: ${{ matrix.go-version }} diff --git a/.golangci.yml b/.golangci.yml index 534c69a..f218e77 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,14 +1,12 @@ run: timeout: 5m - skip-files: [] linters-settings: govet: - check-shadowing: true + enable: + - shadow gocyclo: min-complexity: 14 - maligned: - suggest-new: true goconst: min-len: 3 min-occurrences: 3 @@ -38,16 +36,8 @@ linters-settings: linters: enable-all: true disable: - - deadcode # deprecated - - exhaustivestruct # deprecated - - golint # deprecated - - ifshort # deprecated - - interfacer # deprecated - - maligned # deprecated - - nosnakecase # deprecated - - scopelint # deprecated - - structcheck # deprecated - - varcheck # deprecated + - gomnd # deprecated + - execinquery # deprecated - cyclop # duplicate of gocyclo - sqlclosecheck # not relevant (SQL) - rowserrcheck # not relevant (SQL) @@ -56,10 +46,10 @@ linters: - bodyclose - prealloc - lll - - gomnd + - mnd - wsl - nlreturn - - goerr113 + - err113 - wrapcheck - testpackage - tparallel @@ -67,7 +57,6 @@ linters: - exhaustive - exhaustruct - makezero - - ifshort - noctx - varnamelen @@ -85,3 +74,6 @@ issues: - forbidigo - path: metago/metago.go text: cyclomatic complexity 15 of func `parseMetaGo` is high + - linters: + - usestdlibvars + text: '"100" can be replaced by http.StatusContinue' diff --git a/go.mod b/go.mod index 1100d55..8f08ddc 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,8 @@ module github.com/ldez/grignotin go 1.20 require ( - github.com/stretchr/testify v1.8.4 - golang.org/x/mod v0.15.0 + github.com/stretchr/testify v1.9.0 + golang.org/x/mod v0.19.0 ) require ( diff --git a/go.sum b/go.sum index 73dae3f..3a22879 100644 --- a/go.sum +++ b/go.sum @@ -2,10 +2,10 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8= -golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +golang.org/x/mod v0.19.0 h1:fEdghXQSo20giMthA7cd28ZC+jts4amQ3YMXiP5oMQ8= +golang.org/x/mod v0.19.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=