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

Update go to 1.23 #177

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Ex4amp1e
Copy link

Vladislav Byrgazov added 3 commits October 17, 2024 13:45
Signed-off-by: Vladislav Byrgazov <[email protected]>
Signed-off-by: Vladislav Byrgazov <[email protected]>
Signed-off-by: Vladislav Byrgazov <[email protected]>
Copy link
Member

@denis-tingaikin denis-tingaikin left a comment

Choose a reason for hiding this comment

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

As I can see go mod tidy job is still using go1.20.

Consider re-using jobs from .github repository in ci.yaml workflow. See at https://github.com/networkservicemesh/sdk/blob/main/.github/workflows/ci.yaml

Vladislav Byrgazov added 3 commits November 12, 2024 09:58
Signed-off-by: Vladislav Byrgazov <[email protected]>
Signed-off-by: Vladislav Byrgazov <[email protected]>
Signed-off-by: Vladislav Byrgazov <[email protected]>
@denis-tingaikin
Copy link
Member

denis-tingaikin commented Nov 13, 2024

@Ex4amp1e I've found that we can a bit improve the proposed golangci config.

golangci-linter.patch

diff --git a/.golangci.yml b/.golangci.yml
index 118e88e..083e85d 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -26,6 +26,35 @@ linters-settings:
           - (github.com/sirupsen/logrus.FieldLogger).Warnf
           - (github.com/sirupsen/logrus.FieldLogger).Errorf
           - (github.com/sirupsen/logrus.FieldLogger).Fatalf
+  depguard:
+    rules:
+      main:
+        deny:
+          - pkg: "errors"
+            desc: "Please use \"github.com/pkg/errors\" instead of \"errors\" in go imports"
+  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/api
   gocyclo:
@@ -35,6 +64,8 @@ linters-settings:
   goconst:
     min-len: 2
     min-occurrences: 2
+  lll:
+    line-length: 160
   misspell:
     locale: US
   unparam:
@@ -45,80 +76,46 @@ 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
-      - ptrToRefParam
       - 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:
+    - depguard
+    - revive
     - rowserrcheck
     - goheader
     - bodyclose
@@ -136,7 +133,7 @@ linters:
     - gosimple
     - govet
     - ineffassign
-    # - lll
+    - lll
     - misspell
     - nakedret
     - staticcheck
@@ -155,3 +152,7 @@ issues:
       linters:
         - funlen
       text: "Function 'TestParsePortRange' is too long"
+    - path: pkg/api/networkservice
+      linters:
+        - gosec
+      text: "G115"
diff --git a/pkg/api/networkservice/mechanisms/kernel/helpers.go b/pkg/api/networkservice/mechanisms/kernel/helpers.go
index 1565208..6c53f29 100644
--- a/pkg/api/networkservice/mechanisms/kernel/helpers.go
+++ b/pkg/api/networkservice/mechanisms/kernel/helpers.go
@@ -23,12 +23,13 @@ package kernel
 
 import (
 	"bytes"
-	"errors"
 	"net"
 	"strconv"
 	"strings"
 	"text/template"
 
+	"github.com/pkg/errors"
+
 	"github.com/networkservicemesh/api/pkg/api/networkservice"
 	"github.com/networkservicemesh/api/pkg/api/networkservice/mechanisms/cls"
 )

cc @NikitaSkrynnik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants