Skip to content

Commit

Permalink
Update go to 1.23 (#1193)
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Byrgazov <[email protected]>
Co-authored-by: Vladislav Byrgazov <[email protected]>
  • Loading branch information
Ex4amp1e and Vladislav Byrgazov authored Nov 21, 2024
1 parent befb46e commit f2bf8fd
Show file tree
Hide file tree
Showing 11 changed files with 104 additions and 54 deletions.
77 changes: 33 additions & 44 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
run:
# concurrency: 6
go: "1.20"
go: "1.23"
timeout: 2m
issues-exit-code: 1
tests: true
Expand All @@ -11,13 +11,14 @@ linters-settings:
values:
regexp:
company: .*
copyright-holder: Copyright \(c\) ({{year-range}}) {{company}}\n\n
copyright-holder: Copyright \(c\) ({{mod-year-range}}) {{company}}\n\n
copyright-holders: ({{copyright-holder}})+
errcheck:
check-type-assertions: false
check-blank: false
govet:
check-shadowing: true
enable:
- shadow
settings:
printf:
funcs:
Expand All @@ -26,18 +27,37 @@ linters-settings:
- (github.com/sirupsen/logrus.FieldLogger).Errorf
- (github.com/sirupsen/logrus.FieldLogger).Fatalf
revive:
min-confidence: 0.8
confidence: 0.8
rules:
- name: exported
- name: blank-imports
- name: context-as-argument
- name: context-keys-type
- name: dot-imports
- name: error-return
- name: error-strings
- name: error-naming
- name: exported
- name: increment-decrement
- name: var-naming
- name: package-comments
- name: range
- name: receiver-naming
- name: time-naming
- name: unexported-return
- name: indent-error-flow
- name: errorf
- name: superfluous-else
- name: unreachable-code
goimports:
local-prefixes: github.com/networkservicemesh
gocyclo:
min-complexity: 15
maligned:
suggest-new: true
dupl:
threshold: 150
funlen:
Lines: 100
Statements: 50
lines: 100
statements: 50
goconst:
min-len: 2
min-occurrences: 2
Expand All @@ -57,79 +77,50 @@ linters-settings:
simple: true
range-loops: true
for-loops: false
gosec:
excludes:
- G115
gocritic:
enabled-checks:
- appendAssign
- assignOp
- appendCombine
- argOrder
- badCall
- badCond
- boolExprSimplify
- builtinShadow
- captLocal
- caseOrder
- codegenComment
- commentFormatting
- commentedOutCode
- commentedOutImport
- defaultCaseOrder
- deprecatedComment
- docStub
- dupArg
- dupBranchBody
- dupCase
- dupImport
- dupSubExpr
- elseif
- emptyFallthrough
- emptyStringTest
- equalFold
- evalOrder
- exitAfterDefer
- flagDeref
- flagName
- hexLiteral
- hugeParam
- ifElseChain
- importShadow
- indexAlloc
- initClause
- methodExprCall
- nestingReduce
- newDeref
- nilValReturn
- octalLiteral
- offBy1
- paramTypeCombine
- rangeExprCopy
- rangeValCopy
- regexpMust
- regexpPattern
- singleCaseSwitch
- sloppyLen
- sloppyReassign
- stringXbytes
- switchTrue
- typeAssertChain
- typeSwitchVar
- typeUnparen
- unlabelStmt
- unnamedResult
- unnecessaryBlock
- underef
- unlambda
- unslice
- valSwap
- weakCond
- wrapperFunc
- yodaStyleExpr
linters:
disable-all: true
enable:
- goheader
- bodyclose
- deadcode
- unused
- depguard
- dogsled
- dupl
Expand All @@ -148,14 +139,12 @@ linters:
- ineffassign
- misspell
- nakedret
- exportloopref
- copyloopvar
- staticcheck
- structcheck
- stylecheck
- typecheck
- unconvert
- unparam
- varcheck
- whitespace
issues:
exclude-use-default: false
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/networkservicemesh/cmd-forwarder-vpp

go 1.20
go 1.23

require (
github.com/antonfisher/nested-logrus-formatter v1.3.1
Expand Down
33 changes: 33 additions & 0 deletions go.sum

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions internal/tests/apiparams_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright (c) 2024 Nordix Foundation.
//
// Copyright (c) 2024 Cisco and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -14,6 +16,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build linux
// +build linux

package tests

import (
Expand Down
5 changes: 4 additions & 1 deletion internal/tests/suite_ipsec_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2022-2023 Cisco and/or its affiliates.
// Copyright (c) 2022-2024 Cisco and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
Expand All @@ -14,6 +14,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build linux
// +build linux

// nolint:dupl
package tests

Expand Down
5 changes: 4 additions & 1 deletion internal/tests/suite_vxlan_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2020-2023 Cisco and/or its affiliates.
// Copyright (c) 2020-2024 Cisco and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
Expand All @@ -14,6 +14,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build linux
// +build linux

package tests

import (
Expand Down
5 changes: 4 additions & 1 deletion internal/tests/suite_wireguard_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2020-2023 Cisco and/or its affiliates.
// Copyright (c) 2020-2024 Cisco and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
Expand All @@ -14,6 +14,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build linux
// +build linux

// nolint:dupl
package tests

Expand Down
5 changes: 4 additions & 1 deletion internal/tests/vppinit_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Cisco and/or its affiliates.
// Copyright (c) 2023-2024 Cisco and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
Expand All @@ -14,6 +14,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build linux
// +build linux

package tests

import (
Expand Down
5 changes: 4 additions & 1 deletion internal/vppinit/acl.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2020-2023 Cisco and/or its affiliates.
// Copyright (c) 2020-2024 Cisco and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
Expand All @@ -14,6 +14,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build linux
// +build linux

package vppinit

import (
Expand Down
5 changes: 5 additions & 0 deletions internal/vppinit/apiparams.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright (c) 2024 Nordix Foundation.
//
// Copyright (c) 2024 Cisco and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -14,6 +16,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build linux
// +build linux

package vppinit

import (
Expand Down
11 changes: 7 additions & 4 deletions internal/vppinit/vppinit.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2020-2023 Cisco and/or its affiliates.
// Copyright (c) 2020-2024 Cisco and/or its affiliates.
//
// Copyright (c) 2024 Nordix Foundation.
//
Expand All @@ -18,6 +18,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build linux
// +build linux

// Package vppinit contains initialization code for vpp
package vppinit

Expand Down Expand Up @@ -136,15 +139,15 @@ func getKernelVer() ([2]int, error) {
b = append(b, byte(v))
}
ver := strings.Split(string(b), ".")
maj, err := strconv.Atoi(ver[0])
major, err := strconv.Atoi(ver[0])
if err != nil {
return [2]int{}, err
}
min, err := strconv.Atoi(ver[1])
minor, err := strconv.Atoi(ver[1])
if err != nil {
return [2]int{}, err
}
return [2]int{maj, min}, nil
return [2]int{major, minor}, nil
}

// LinkToSocket - will link vpp via af_packet or af_xdp to the interface having the tunnelIP
Expand Down

0 comments on commit f2bf8fd

Please sign in to comment.