Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade go to v1.23.1 #1664

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: 48 additions & 90 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,54 @@ linters-settings:
simple: true
range-loops: true
for-loops: false
gosec:
excludes:
- G115
- G204
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we excluding G204

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

G204 was included in exclude-rules list before, but on the current linter version we are getting too many new gosec errors, so decided to put them into one place- general config, not individually

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, add a todo and refer to the issue where we plan to fix these issues.

- 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 +136,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 +157,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 +196,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 +208,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 +230,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,11 +246,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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a ticket to refer here. Thanks.

- path: pkg/tools/tracing/grpcoptions.go
linters:
- staticcheck
text: "SA1019: otelgrpc.*"
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
Loading