From 1338df89981ff6197ee70c1bb78d79162541dee0 Mon Sep 17 00:00:00 2001 From: Anoop C S Date: Thu, 22 Aug 2024 16:36:08 +0530 Subject: [PATCH 1/3] hack: Bump golangci-lint to v1.60.2 - The linter 'exportloopref' is deprecated (since v1.60.2) due to: Since Go1.22 (loopvar) this linter is no longer relevant. Replaced by copyloopvar. - The linter named \"megacheck\" is deprecated. It has been split into: gosimple, staticcheck, unused. - The configuration option `linters.govet.check-shadowing` is deprecated. Please enable `shadow` instead, if you are not using `enable-all`. Also fixes all occurrence of "Error: printf: non-constant format string in call to fmt.Errorf (govet)" error. Signed-off-by: Anoop C S --- .golangci.yaml | 4 +--- hack/install-tools.sh | 2 +- internal/resources/smbshare.go | 6 +++--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index 5990ea04..bdc11dbb 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -9,7 +9,7 @@ linters: - dupl - errcheck - exhaustive - - exportloopref + - copyloopvar - funlen # - gci - goconst @@ -23,7 +23,6 @@ linters: # - ineffassign # - ifshort - lll - - megacheck - misspell # - nlreturn # - nolintlint @@ -42,7 +41,6 @@ linters-settings: lines: 188 statements: 60 govet: - check-shadowing: true enable-all: true disable: - fieldalignment diff --git a/hack/install-tools.sh b/hack/install-tools.sh index a720f490..4d1809e3 100755 --- a/hack/install-tools.sh +++ b/hack/install-tools.sh @@ -44,7 +44,7 @@ _install_revive() { } _install_golangci_lint() { - _install_tool github.com/golangci/golangci-lint/cmd/golangci-lint@v1.53.3 + _install_tool github.com/golangci/golangci-lint/cmd/golangci-lint@v1.60.2 } _install_yq() { diff --git a/internal/resources/smbshare.go b/internal/resources/smbshare.go index 2a65e301..38846439 100644 --- a/internal/resources/smbshare.go +++ b/internal/resources/smbshare.go @@ -851,7 +851,7 @@ func (m *SmbShareManager) setServerGroup( EventWarning, ReasonInvalidConfiguration, msg) - return false, fmt.Errorf(msg) + return false, fmt.Errorf("%s", msg) } case pln.GroupModeExplicit: if reqGroupName == "" { @@ -861,7 +861,7 @@ func (m *SmbShareManager) setServerGroup( EventWarning, ReasonInvalidConfiguration, msg) - return false, fmt.Errorf(msg) + return false, fmt.Errorf("%s", msg) } serverGroup = reqGroupName default: @@ -871,7 +871,7 @@ func (m *SmbShareManager) setServerGroup( EventWarning, ReasonInvalidConfiguration, msg) - return false, fmt.Errorf(msg) + return false, fmt.Errorf("%s", msg) } s.Status.ServerGroup = serverGroup From ef5cba198290ff61bd71c8944d888c17203027ca Mon Sep 17 00:00:00 2001 From: Anoop C S Date: Thu, 22 Aug 2024 17:10:17 +0530 Subject: [PATCH 2/3] hack: Bump gosec to v2.20.0 Updating gosec to avoid the panic raised with go1.22. Signed-off-by: Anoop C S --- hack/install-tools.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hack/install-tools.sh b/hack/install-tools.sh index 4d1809e3..bc493baa 100755 --- a/hack/install-tools.sh +++ b/hack/install-tools.sh @@ -52,7 +52,7 @@ _install_yq() { } _install_gosec() { - _install_tool github.com/securego/gosec/v2/cmd/gosec@v2.13.1 + _install_tool github.com/securego/gosec/v2/cmd/gosec@v2.20.0 } _install_gitlint() { From 2f5f089fd2f6ce5adb4ed87778df5075d7caa14e Mon Sep 17 00:00:00 2001 From: Anoop C S Date: Thu, 22 Aug 2024 17:21:26 +0530 Subject: [PATCH 3/3] Dockerfile: Bump Go version to 1.22 go1.23 is now available making go1.22 the oldest supported release. We should now update the Dockerfile accordingly to make go-version-check.sh happy. Signed-off-by: Anoop C S --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e94c586f..f922327c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Build the manager binary -FROM docker.io/golang:1.21 as builder +FROM docker.io/golang:1.22 as builder ARG GIT_VERSION="(unset)" ARG COMMIT_ID="(unset)" ARG ARCH=""