Skip to content

Commit

Permalink
Upgrade go to v1.23 (#1664)
Browse files Browse the repository at this point in the history
* Upgrade go to v1.23

Signed-off-by: Vladislav Byrgazov <[email protected]>

* Update linter config

Signed-off-by: Vladislav Byrgazov <[email protected]>

* Add todo to fix linters

Signed-off-by: Vladislav Byrgazov <[email protected]>

* Skip TestNSMGRHealEndpoint_DatapathHealthy_CtrlPlaneBroken test

Signed-off-by: Vladislav Byrgazov <[email protected]>

---------

Signed-off-by: Vladislav Byrgazov <[email protected]>
Co-authored-by: Vladislav Byrgazov <[email protected]>
  • Loading branch information
Ex4amp1e and Vladislav Byrgazov authored Nov 19, 2024
1 parent b53ccb0 commit cb2dbb0
Show file tree
Hide file tree
Showing 39 changed files with 191 additions and 242 deletions.
2 changes: 2 additions & 0 deletions .ci/yamllint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ rules:
line-length: disable
comments-indentation:
ignore: .circleci/config.yml
comments:
min-spaces-from-content: 1

ignore: scripts/aws/aws-k8s-cni.yaml
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
golangci-lint:
uses: networkservicemesh/.github/.github/workflows/golangci-lint.yaml@main
with:
linter-version: v1.53.3
linter-version: v1.60.3

exclude-fmt-errorf:
uses: networkservicemesh/.github/.github/workflows/exclude-fmt-errorf.yaml@main
Expand Down Expand Up @@ -45,9 +45,9 @@ jobs:
- name: Check out code
uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v1
uses: actions/setup-go@v5
with:
go-version: 1.20.5
go-version: 1.23.1
- run: |
go test -coverprofile=coverage-${{ matrix.os }}.txt -covermode=atomic -race ./...
- name: Upload coverage reports to Codecov with GitHub Action
Expand Down
138 changes: 49 additions & 89 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,33 +11,53 @@ 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:
- (github.com/sirupsen/logrus.FieldLogger).Infof
- (github.com/sirupsen/logrus.FieldLogger).Warnf
- (github.com/sirupsen/logrus.FieldLogger).Errorf
- (github.com/sirupsen/logrus.FieldLogger).Fatalf
golint:
min-confidence: 0.8
revive:
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/sdk
gocyclo:
min-complexity: 15
maligned:
suggest-new: true
dupl:
threshold: 150
funlen:
Lines: 120
Statements: 60
lines: 120
statements: 60
goconst:
min-len: 2
min-occurrences: 2
Expand All @@ -57,79 +77,55 @@ linters-settings:
simple: true
range-loops: true
for-loops: false
# TODO - Fix gosec linter errors - https://github.com/networkservicemesh/sdk/issues/1690
gosec:
excludes:
- G115
- G204
- G301
- G302
- G306
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 @@ -141,22 +137,19 @@ linters:
- gocyclo
- gofmt
- goimports
- golint
- revive
- gosec
- gosimple
- govet
- ineffassign
- interfacer
- misspell
- nakedret
- scopelint
- copyloopvar
- staticcheck
- structcheck
- stylecheck
- typecheck
- unconvert
- unparam
- varcheck
- whitespace
issues:
exclude-use-default: false
Expand All @@ -165,13 +158,6 @@ issues:
exclude-rules:
# We really *do* want to pass a pointer to an interface in these cases. See comments in file for New{Server,Client}
# function for why
- path: .*\.gen\.go
linters:
- dupl
- golint
- path: pkg/tools/opa/policies.go
linters:
- golint
- path: .*registry.*.go
linters:
- dupl
Expand Down Expand Up @@ -211,10 +197,6 @@ issues:
linters:
- dupl
text: "lines are duplicate of"
- path: pkg/tools/spiffeutils/spiffeutils.go
linters:
- interfacer
text: "can be `fmt.Stringer`"
- path: pkg/networkservice/core/trace/client.go
linters:
- dupl
Expand All @@ -227,30 +209,10 @@ issues:
linters:
- dupl
text: "lines are duplicate of"
- path: pkg/tools/spiffeutils/tls_peer.go
linters:
- gosec
text: "G402: TLS InsecureSkipVerify set true"
- path: pkg/networkservice/common/updatepath/server_test.go
linters:
- gochecknoinits
text: "don't use `init` function"
- path: pkg/tools/debug/self.go
linters:
- gosec
text: "G204: Subprocess launched with variable"
- path: pkg/tools/executils/start.go
linters:
- gosec
text: "G204: Subprocess launched with variable"
- path: pkg/tools/executils/run.go
linters:
- gosec
text: "G204: Subprocess launched with variable"
- path: pkg/tools/executils/output.go
linters:
- gosec
text: "G204: Subprocess launched with variable"
- path: pkg/tools/spire/start.go
linters:
- funlen
Expand All @@ -269,14 +231,6 @@ issues:
- path: pkg/networkservice/chains/nsmgr/single_test.go
linters:
- funlen
- path: pkg/registry/common/recvfd/gen.go
linters:
- structcheck
text: "is unused"
- path: pkg/networkservice/common/mechanisms/recvfd/gen.go
linters:
- structcheck
text: "is unused"
- path: pkg/networkservice/common/discover/server_test.go
linters:
- dupl
Expand All @@ -293,10 +247,16 @@ issues:
- path: pkg/networkservice/common/switchcase/.*_test.go
linters:
- dupl
- path: pkg/networkservice/chains/endpoint/combine_monitor_server.go
- path: pkg/tools/ippool/ippool.go
linters:
- unused
- path: pkg/networkservice/common/switchcase/common_test.go
linters:
- revive
- path: pkg/tools/opa/policies.go
linters:
- interfacer
text: "`rawSrv` can be `github.com/networkservicemesh/sdk/pkg/networkservice/common/monitor.EventConsumer`"
- revive
# TODO - remove deprecated opentelemetry functions - https://github.com/networkservicemesh/sdk/issues/1691
- path: pkg/tools/tracing/grpcoptions.go
linters:
- staticcheck
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/sdk

go 1.20
go 1.23

require (
github.com/RoaringBitmap/roaring v0.9.4
Expand Down
Loading

0 comments on commit cb2dbb0

Please sign in to comment.