[VOL-5475] upgrade go to 1.24.5 and golangci-lint version to 2.2.2
Signed-off-by: mgouda <madhumati.gouda@radisys.com>
Change-Id: I1e8c4c29c8dd9539f6f7233405d8e1a26ed3ab00
diff --git a/.golangci.yml b/.golangci.yml
index 92569b7..cbda152 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -11,6 +11,46 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+version: "2"
+
+linters:
+ enable:
+ #- gochecknoglobals
+ #- gochecknoinits
+ - gocritic
+ - gosec
+ - errcheck
+ - gocyclo
+ - govet
+ - ineffassign
+ - misspell
+ - gosec
+ - staticcheck
+ - unused
+ - unparam
+ exclusions:
+ rules:
+ - path: ".*_test.go"
+ linters:
+ - gocritic
+ - gosec
+ - govet
+ - fieldalignment
+ - unparam
+ - staticcheck
+
+ - text: "ifElseChain:"
+ linters:
+ - gocritic
+ - text: "G115: integer overflow conversion"
+ linters:
+ - gosec
+ - text: "SA1019"
+ linters:
+ - staticcheck
+ - text: "QF1008: could remove embedded field"
+ linters:
+ - staticcheck
linters-settings:
govet:
@@ -25,42 +65,10 @@
- cancelled
- artefacts
+formatters:
+ enable:
+ - gofmt
+ - goimports
+
run:
modules-download-mode: vendor
-
-linters:
- enable:
- #- gochecknoglobals
- #- gochecknoinits
- - gocritic
- - gofmt
- - gosec
- - errcheck
- - gocyclo
- - govet
- - ineffassign
- - misspell
- - gosec
- - goimports
- - gosimple
- - staticcheck
- - unused
- - unparam
-
-issues:
- exclude-use-default: false #we should decide ourselves about false positives
- exclude-rules:
- - path: ".*_test.go"
- linters:
- - errcheck
- - gocritic
- - gosec
- - govet
- - fieldalignment
- - unparam
- - linters:
- - gocritic
- text: "ifElseChain:" #it should be up to a developer to decide which operator to use
- exclude:
- - SA1019
- - 'G115: integer overflow conversion'
diff --git a/VERSION b/VERSION
index 1bff231..4cc5902 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-3.6.21
+3.6.22
diff --git a/docker/Dockerfile.rw_core b/docker/Dockerfile.rw_core
index f7147de..32ea2b3 100644
--- a/docker/Dockerfile.rw_core
+++ b/docker/Dockerfile.rw_core
@@ -30,7 +30,7 @@
# -------------
# Build stage
-FROM golang:1.23.1-alpine3.20 AS dev
+FROM golang:1.24.5-alpine3.22 AS dev
# Install required packages
diff --git a/go.mod b/go.mod
index 1b718e2..1792181 100644
--- a/go.mod
+++ b/go.mod
@@ -1,6 +1,6 @@
module github.com/opencord/voltha-go
-go 1.23.0
+go 1.24.5
replace (
github.com/coreos/bbolt v1.3.4 => go.etcd.io/bbolt v1.3.4
diff --git a/makefiles/analysis/sca.mk b/makefiles/analysis/sca.mk
index 48bc999..48a4c41 100644
--- a/makefiles/analysis/sca.mk
+++ b/makefiles/analysis/sca.mk
@@ -25,7 +25,7 @@
@$(RM) -r ./sca-report
@mkdir -p ./sca-report
@echo "Running static code analysis..."
- @${GOLANGCI_LINT} run --out-format junit-xml ./... | tee ./sca-report/sca-report.xml
+ @${GOLANGCI_LINT} run --output.text.path=stdout --output.junit-xml.path=./sca-report/sca-report.xml ./...
@echo ""
@echo "Static code analysis OK"
diff --git a/makefiles/docker/include.mk b/makefiles/docker/include.mk
index 594dcd5..78b9b33 100644
--- a/makefiles/docker/include.mk
+++ b/makefiles/docker/include.mk
@@ -17,7 +17,7 @@
$(if $(DEBUG),$(warning ENTER))
-VOLTHA_TOOLS_VERSION ?= 3.1.1
+VOLTHA_TOOLS_VERSION ?= 3.1.3
# ---------------------------
# Macros: command refactoring
diff --git a/rw_core/core/device/agent.go b/rw_core/core/device/agent.go
index 040d65a..74c2475 100755
--- a/rw_core/core/device/agent.go
+++ b/rw_core/core/device/agent.go
@@ -33,7 +33,6 @@
"github.com/gogo/protobuf/proto"
"github.com/golang/protobuf/ptypes/empty"
"github.com/opencord/voltha-go/rw_core/config"
- "github.com/opencord/voltha-go/rw_core/utils"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
@@ -1418,7 +1417,7 @@
func (agent *Agent) DeleteDevicePostAdapterRestart(ctx context.Context) error {
logger.Debugw(ctx, "delete-post-restart", log.Fields{"device-id": agent.deviceID})
- ctx = utils.WithNewSpanAndRPCMetadataContext(ctx, "DelteDevicePostAdapterRestart")
+ ctx = coreutils.WithNewSpanAndRPCMetadataContext(ctx, "DelteDevicePostAdapterRestart")
if err := agent.requestQueue.WaitForGreenLight(ctx); err != nil {
return err
diff --git a/rw_core/core/device/logical_agent_meter_helpers.go b/rw_core/core/device/logical_agent_meter_helpers.go
index 546891a..22ff7ca 100644
--- a/rw_core/core/device/logical_agent_meter_helpers.go
+++ b/rw_core/core/device/logical_agent_meter_helpers.go
@@ -75,13 +75,14 @@
oldMeter := meterHandle.GetReadOnly()
// avoiding using proto.Clone by only copying what have changed (this assumes that the oldMeter will never be modified)
newStats := *oldMeter.Stats
- if flowCommand == ofp.OfpFlowModCommand_OFPFC_ADD {
+ switch flowCommand {
+ case ofp.OfpFlowModCommand_OFPFC_ADD:
if revertUpdate {
newStats.FlowCount--
} else {
newStats.FlowCount++
}
- } else if flowCommand == ofp.OfpFlowModCommand_OFPFC_DELETE_STRICT {
+ case ofp.OfpFlowModCommand_OFPFC_DELETE_STRICT:
if revertUpdate {
newStats.FlowCount++
} else {
diff --git a/rw_core/core/device/state/transitions.go b/rw_core/core/device/state/transitions.go
index 8b5da90..74538ec 100644
--- a/rw_core/core/device/state/transitions.go
+++ b/rw_core/core/device/state/transitions.go
@@ -400,6 +400,8 @@
}
// isMatched matches a state transition. It returns whether there is a match and if there is whether it is an exact match
+//
+//nolint:gocyclo
func getHandler(previous deviceState, current deviceState, transition *transition) ([]transitionHandler, *match) {
m := &match{}
var waitForOtherStatesMatch bool
diff --git a/rw_core/test/core_nbi_handler_multi_test.go b/rw_core/test/core_nbi_handler_multi_test.go
index 471bc2e..6c913e6 100755
--- a/rw_core/test/core_nbi_handler_multi_test.go
+++ b/rw_core/test/core_nbi_handler_multi_test.go
@@ -2163,7 +2163,7 @@
if err != nil {
logger.Fatalf(ctx, "could not create CPU profile: %v\n ", err)
}
- defer f.Close()
+ defer func() { _ = f.Close() }()
runtime.SetBlockProfileRate(1)
runtime.SetMutexProfileFraction(-1)
runtime.SetCPUProfileRate(200)