[VOL-5449] upgrade go to 1.24 and golangci-lint version to 2.0.2
Change-Id: I9437bf0f6460fef7416ea253d26cb24d78bca668
Signed-off-by: Akash Reddy Kankanala <akash.kankanala@radisys.com>
diff --git a/.golangci.yml b/.golangci.yml
index 92569b7..f3db757 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -11,7 +11,7 @@
# 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-settings:
govet:
enable:
@@ -33,7 +33,6 @@
#- gochecknoglobals
#- gochecknoinits
- gocritic
- - gofmt
- gosec
- errcheck
- gocyclo
@@ -41,26 +40,52 @@
- ineffassign
- misspell
- gosec
- - goimports
- - gosimple
- 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'
+ linters:
+ - staticcheck
-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'
+formatters:
+ enable:
+ - gofmt
+ - goimports
+
+# 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 cff2619..c47e8b5 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-3.6.9
+3.6.10
diff --git a/docker/Dockerfile.rw_core b/docker/Dockerfile.rw_core
index f7147de..70e9a49 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.0-alpine3.20 AS dev
# Install required packages
diff --git a/go.mod b/go.mod
index 2e88ada..3adafab 100644
--- a/go.mod
+++ b/go.mod
@@ -1,6 +1,6 @@
module github.com/opencord/voltha-go
-go 1.23
+go 1.24.0
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..927ab00 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.2
# ---------------------------
# Macros: command refactoring
diff --git a/rw_core/core/device/agent.go b/rw_core/core/device/agent.go
index 649eb3f..64f2f08 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"
@@ -1401,7 +1400,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 ebc720c..6e27f84 100644
--- a/rw_core/core/device/state/transitions.go
+++ b/rw_core/core/device/state/transitions.go
@@ -399,6 +399,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)