From e1bb1f7af56126fcc6e96cc334e7c201500a6fc9 Mon Sep 17 00:00:00 2001 From: rabbitstack Date: Mon, 28 Sep 2026 15:05:14 +0200 Subject: [PATCH] chore(build): Bump Go to 1.27.x The upgrade to Go 1.27.x requires golangci-lint bump. As a consequence, some linters were ignored and a few sources were adjusted to fmt.Fprintf to placate golangci linters. --- .github/workflows/master.yml | 6 +++--- .github/workflows/pr.yml | 6 +++--- .github/workflows/release.yml | 2 +- .golangci.yml | 27 +++++++++++++++++++++++++++ go.mod | 2 +- make.bat | 4 +++- pkg/alertsender/alert.go | 2 +- pkg/config/print.go | 2 +- 8 files changed, 40 insertions(+), 11 deletions(-) diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index a9b42e483..9bda74cb2 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -10,7 +10,7 @@ on: - "docs/**" env: - GO_VERSION: 1.26.x + GO_VERSION: 1.27.x WIX_VERSION: 5.0.0 PYTHON_VERSION: 3.7.9 @@ -230,9 +230,9 @@ jobs: - name: Install golangci-lint shell: bash run: | - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin $GOLANGCI_LINT_VER + curl -sSfL https://golangci-lint.run/install.sh | sh -s -- -b $(go env GOPATH)/bin $GOLANGCI_LINT_VER env: - GOLANGCI_LINT_VER: v2.9.0 + GOLANGCI_LINT_VER: v2.14.0 - name: Lint shell: bash run: | diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 430b92114..b3369112b 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -12,7 +12,7 @@ concurrency: cancel-in-progress: true env: - GO_VERSION: 1.26.x + GO_VERSION: 1.27.x WIX_VERSION: 5.0.0 PYTHON_VERSION: 3.7.9 @@ -216,9 +216,9 @@ jobs: - name: Install golangci-lint shell: bash run: | - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin $GOLANGCI_LINT_VER + curl -sSfL https://golangci-lint.run/install.sh | sh -s -- -b $(go env GOPATH)/bin $GOLANGCI_LINT_VER env: - GOLANGCI_LINT_VER: v2.9.0 + GOLANGCI_LINT_VER: v2.14.0 - name: Lint shell: bash run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e75b60d86..41a2de899 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,7 +6,7 @@ on: - 'v*' env: - GO_VERSION: 1.26.x + GO_VERSION: 1.27.x WIX_VERSION: 5.0.0 PYTHON_VERSION: 3.7.9 diff --git a/.golangci.yml b/.golangci.yml index 92a33a603..abc35b26c 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -35,7 +35,33 @@ linters: - nolintlint - staticcheck - noctx + - goconst + - unparam path: _test\.go + - linters: + - goconst + path: pkg/util/ports/iana_ports.go + - linters: + - goconst + path: pkg/event/flags.go + - linters: + - goconst + path: pkg/filter/ql/functions/(.+)\.go + - linters: + - goconst + path: pkg/filter/ql/parser.go + - linters: + - goconst + path: pkg/filter/ql/function.go + - linters: + - goconst + path: pkg/filter/fields/fields_windows.go + - linters: + - goconst + path: cmd/fibratus/app/list/list.go + - linters: + - goconst + path: cmd/fibratus/app/rules/list.go paths: - third_party$ - builtin$ @@ -53,3 +79,4 @@ formatters: - third_party$ - builtin$ - examples$ + diff --git a/go.mod b/go.mod index b15fa21d4..77416beba 100644 --- a/go.mod +++ b/go.mod @@ -98,4 +98,4 @@ require ( gopkg.in/yaml.v2 v2.3.0 // indirect ) -go 1.26.0 +go 1.27.0 diff --git a/make.bat b/make.bat index f344d24d0..4ee340d22 100644 --- a/make.bat +++ b/make.bat @@ -16,6 +16,8 @@ set PYTHON_URL=https://www.python.org/ftp/python/%PYTHON_VER%/python-%PYTHON_VER set WIX_VERSION=5.0.0 +set GOLANGCI_LINT_VERSION=2.14.0 + set GOBIN=%USERPROFILE%\go\bin set GOTEST=go test -timeout=10m -v -gcflags=all=-d=checkptr=0 @@ -80,7 +82,7 @@ goto :EOF goto :EOF :deps -go get -v -u github.com/golangci/golangci-lint/cmd/golangci-lint@v1.52.2 +go get -v -u github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v%GOLANGCI_LINT_VERSION% goto :EOF :rsrc diff --git a/pkg/alertsender/alert.go b/pkg/alertsender/alert.go index a785cc9b8..4c0e64f9a 100644 --- a/pkg/alertsender/alert.go +++ b/pkg/alertsender/alert.go @@ -136,7 +136,7 @@ func (a Alert) String(verbose bool) string { b.WriteString("System event involved in this alert:\n\n") } for n, evt := range a.Events { - b.WriteString(fmt.Sprintf("\tEvent #%d:\n", n+1)) + fmt.Fprintf(&b, "\tEvent #%d:\n", n+1) b.WriteString(strings.TrimSuffix(evt.StringShort(), "\t")) } if a.Text == "" { diff --git a/pkg/config/print.go b/pkg/config/print.go index df68ca868..2f29c62b5 100644 --- a/pkg/config/print.go +++ b/pkg/config/print.go @@ -29,7 +29,7 @@ import ( func (c *Config) printArray(arr []interface{}) string { var buffer bytes.Buffer for v := range arr { - buffer.WriteString(fmt.Sprintf("%v;", v)) + fmt.Fprintf(&buffer, "%v;", v) } return buffer.String() }