diff --git a/.github/workflows/bats-hub.yml b/.github/workflows/bats-hub.yml index e6d9ae86a..02fa78adf 100644 --- a/.github/workflows/bats-hub.yml +++ b/.github/workflows/bats-hub.yml @@ -23,10 +23,10 @@ jobs: sudo chmod +w /etc/machine-id echo githubciXXXXXXXXXXXXXXXXXXXXXXXX | sudo tee /etc/machine-id - - name: "Set up Go 1.19" + - name: "Set up Go 1.20" uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: 1.20.1 id: go - name: "Clone CrowdSec" diff --git a/.github/workflows/bats-mysql.yml b/.github/workflows/bats-mysql.yml index f398fd886..fceaf9c2c 100644 --- a/.github/workflows/bats-mysql.yml +++ b/.github/workflows/bats-mysql.yml @@ -10,9 +10,7 @@ on: env: PREFIX_TEST_NAMES_WITH_FILE: true - jobs: - build: name: "Build + tests" runs-on: ubuntu-latest @@ -32,10 +30,10 @@ jobs: sudo chmod +w /etc/machine-id echo githubciXXXXXXXXXXXXXXXXXXXXXXXX | sudo tee /etc/machine-id - - name: "Set up Go 1.19" + - name: "Set up Go 1.20" uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: 1.20.1 id: go - name: "Check out CrowdSec repository" diff --git a/.github/workflows/bats-postgres.yml b/.github/workflows/bats-postgres.yml index 9e7190eed..3abbaa4ff 100644 --- a/.github/workflows/bats-postgres.yml +++ b/.github/workflows/bats-postgres.yml @@ -7,7 +7,6 @@ env: PREFIX_TEST_NAMES_WITH_FILE: true jobs: - build: name: "Build + tests" runs-on: ubuntu-latest @@ -32,10 +31,10 @@ jobs: sudo chmod +w /etc/machine-id echo githubciXXXXXXXXXXXXXXXXXXXXXXXX | sudo tee /etc/machine-id - - name: "Set up Go 1.19" + - name: "Set up Go 1.20" uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: 1.20.1 id: go - name: "Check out CrowdSec repository" diff --git a/.github/workflows/bats-sqlite-coverage.yml b/.github/workflows/bats-sqlite-coverage.yml index fd497f13d..e691ca4b2 100644 --- a/.github/workflows/bats-sqlite-coverage.yml +++ b/.github/workflows/bats-sqlite-coverage.yml @@ -21,10 +21,10 @@ jobs: sudo chmod +w /etc/machine-id echo githubciXXXXXXXXXXXXXXXXXXXXXXXX | sudo tee /etc/machine-id - - name: "Set up Go 1.19" + - name: "Set up Go 1.20" uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: 1.20.1 id: go - name: "Check out CrowdSec repository" diff --git a/.github/workflows/ci-windows-build-msi.yml b/.github/workflows/ci-windows-build-msi.yml index a24e12ea7..4ea2dbc43 100644 --- a/.github/workflows/ci-windows-build-msi.yml +++ b/.github/workflows/ci-windows-build-msi.yml @@ -25,10 +25,10 @@ jobs: name: Build runs-on: windows-2019 steps: - - name: Set up Go 1.19 + - name: Set up Go 1.20 uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: 1.20.1 id: go - name: Check out code into the Go module directory uses: actions/checkout@v3 diff --git a/.github/workflows/ci_golangci-lint.yml b/.github/workflows/ci_golangci-lint.yml index 0b5a819dc..3e3459963 100644 --- a/.github/workflows/ci_golangci-lint.yml +++ b/.github/workflows/ci_golangci-lint.yml @@ -24,18 +24,15 @@ jobs: name: lint runs-on: ${{ matrix.os }} steps: - - name: Set up Go 1.19 + - name: Set up Go 1.20 uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: 1.20.1 id: go - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version: 1.19 - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: - version: v1.50 + version: v1.51 args: --issues-exit-code=1 --timeout 10m only-new-issues: false diff --git a/.github/workflows/go-tests-windows.yml b/.github/workflows/go-tests-windows.yml index 4d9e176af..a00d0c5d8 100644 --- a/.github/workflows/go-tests-windows.yml +++ b/.github/workflows/go-tests-windows.yml @@ -26,10 +26,10 @@ jobs: steps: - - name: "Set up Go 1.19" + - name: "Set up Go 1.20" uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: 1.20.1 id: go - name: Check out CrowdSec repository diff --git a/.github/workflows/go-tests.yml b/.github/workflows/go-tests.yml index ca134af54..dcdbc5508 100644 --- a/.github/workflows/go-tests.yml +++ b/.github/workflows/go-tests.yml @@ -33,11 +33,10 @@ env: CROWDSEC_FEATURE_DISABLE_HTTP_RETRY_BACKOFF: true jobs: - build: strategy: matrix: - go-version: ["1.19", "1.20.0-rc.1"] + go-version: ["1.20.1"] name: "Build + tests" runs-on: ubuntu-latest @@ -74,7 +73,7 @@ jobs: --health-interval 10s --health-timeout 5s --health-retries 5 - + kafka1: image: crowdsecurity/kafka-ssl ports: diff --git a/.github/workflows/release_publish-package.yml b/.github/workflows/release_publish-package.yml index 8f19752cd..fa3aa8589 100644 --- a/.github/workflows/release_publish-package.yml +++ b/.github/workflows/release_publish-package.yml @@ -11,10 +11,10 @@ jobs: name: Build and upload binary package runs-on: ubuntu-latest steps: - - name: Set up Go 1.19 + - name: Set up Go 1.20 uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: 1.20.1 id: go - name: Check out code into the Go module directory uses: actions/checkout@v3 @@ -32,10 +32,10 @@ jobs: name: Build and upload binary package runs-on: ubuntu-latest steps: - - name: Set up Go 1.19 + - name: Set up Go 1.20 uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: 1.20.1 id: go - name: Check out code into the Go module directory uses: actions/checkout@v3 diff --git a/.golangci.yml b/.golangci.yml index 74c9dafdc..79900ae7d 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -71,6 +71,7 @@ linters: # - errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases # - exportloopref # checks for pointers to enclosing loop variables # - funlen # Tool for detection of long functions + # - ginkgolinter # enforces standards of using ginkgo and gomega # - gochecknoinits # Checks that no init functions are present in Go code # - gocritic # Provides diagnostics that check for bugs, performance and style issues. # - goheader # Checks is file header matches to pattern @@ -115,6 +116,7 @@ linters: - goimports # In addition to fixing imports, goimports also formats your code in the same style as gofmt. - gosec # (gas): Inspects source code for security problems - lll # Reports long lines + - musttag # enforce field tags in (un)marshaled structs - nakedret # Finds naked returns in functions greater than a specified function length - nonamedreturns # Reports all named returns - nosprintfhostport # Checks for misuse of Sprintf to construct a host with port in a URL. @@ -182,6 +184,9 @@ linters: issues: + # “Look, that’s why there’s rules, understand? So that you think before you + # break ‘em.” ― Terry Pratchett + max-issues-per-linter: 0 max-same-issues: 10 exclude-rules: @@ -220,3 +225,7 @@ issues: - linters: - gocritic text: "commentFormatting: put a space between `//` and comment text" + + - linters: + - staticcheck + text: "x509.ParseCRL has been deprecated since Go 1.19: Use ParseRevocationList instead" diff --git a/Dockerfile b/Dockerfile index 1d1eff1cd..f7051119d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # vim: set ft=dockerfile: -ARG GOVERSION=1.19 +ARG GOVERSION=1.20.1 FROM golang:${GOVERSION}-alpine AS build diff --git a/Dockerfile.debian b/Dockerfile.debian index 1dbbc70c5..a117363f9 100644 --- a/Dockerfile.debian +++ b/Dockerfile.debian @@ -1,5 +1,5 @@ # vim: set ft=dockerfile: -ARG GOVERSION=1.19 +ARG GOVERSION=1.20.1 FROM golang:${GOVERSION}-bullseye AS build diff --git a/Makefile b/Makefile index 7e4ba1ea1..763f0ba33 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,7 @@ CSCLI_BIN = cscli$(EXT) BUILD_CMD = build MINIMUM_SUPPORTED_GO_MAJOR_VERSION = 1 -MINIMUM_SUPPORTED_GO_MINOR_VERSION = 19 +MINIMUM_SUPPORTED_GO_MINOR_VERSION = 20 go_major_minor = $(subst ., ,$(BUILD_GOVERSION)) GO_MAJOR_VERSION = $(word 1, $(go_major_minor)) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 80327c949..30df1edb1 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -25,12 +25,11 @@ stages: custom: 'tool' arguments: 'install --global SignClient --version 1.3.155' - task: GoTool@0 - displayName: "Install Go 1.19" + displayName: "Install Go 1.20" inputs: - version: '1.19' + version: '1.20.1' - pwsh: | - choco install -y jq choco install -y make displayName: "Install builds deps" - task: PowerShell@2