Skip to content

Commit 8ab47c6

Browse files
authored
ci(lint): update tooling and workflows for consistency (#3834)
* chore: update tooling and workflows for consistency - Update the version of a tool in the GitHub workflow from `v1.52.2` to `v1.55.2` Signed-off-by: Bo-Yi Wu * chore: refactor linter configuration in CI - Remove the `depguard` linter from the `.golangci.yml` configuration Signed-off-by: Bo-Yi Wu * ci: refine CI workflow and test configurations - Disable caching in the GitHub Actions workflow for `gin.yml` Signed-off-by: Bo-Yi Wu * refactor: refactor return logic in tree operations - Modify multiple return statements in `tree.go` to return a specific value instead of nothing Signed-off-by: Bo-Yi Wu --------- Signed-off-by: Bo-Yi Wu
1 parent 4a40f8f commit 8ab47c6

4 files changed

Lines changed: 14 additions & 17 deletions

File tree

‎.github/workflows/gin.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Setup golangci-lint
2525
uses: golangci/golangci-lint-action@v3.7.0
2626
with:
27-
version: v1.52.2
27+
version: v1.55.2
2828
args: --verbose
2929
test:
3030
needs: lint
@@ -49,6 +49,7 @@ jobs:
4949
uses: actions/setup-go@v5
5050
with:
5151
go-version: ${{ matrix.go }}
52+
cache: false
5253

5354
- name: Checkout Code
5455
uses: actions/checkout@v4

‎.golangci.yml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ run:
33
linters:
44
enable:
55
- asciicheck
6-
- depguard
76
- dogsled
87
- durationcheck
98
- errcheck

‎go.sum‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,13 @@ github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZ
6060
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
6161
golang.org/x/arch v0.3.0 h1:02VY4/ZcO/gBOH6PUaoiptASxtXU10jazRCP865E97k=
6262
golang.org/x/arch v0.3.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
63-
golang.org/x/crypto v0.15.0 h1:frVn1TEaCEaZcn3Tmd7Y2b5KKPaZ+I32Q2OA3kYp5TA=
64-
golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g=
6563
golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k=
6664
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
6765
golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg=
6866
golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ=
6967
golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
7068
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
71-
golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q=
72-
golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
69+
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
7370
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
7471
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
7572
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=

‎tree.go‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ walk: // Outer loop for walking the tree
478478
// We can recommend to redirect to the same URL without a
479479
// trailing slash if a leaf exists for that path.
480480
value.tsr = path == "/" && n.handlers != nil
481-
return
481+
return value
482482
}
483483

484484
// Handle wildcard child, which is always at the end of the array
@@ -533,20 +533,20 @@ walk: // Outer loop for walking the tree
533533

534534
// ... but we can't
535535
value.tsr = len(path) == end+1
536-
return
536+
return value
537537
}
538538

539539
if value.handlers = n.handlers; value.handlers != nil {
540540
value.fullPath = n.fullPath
541-
return
541+
return value
542542
}
543543
if len(n.children) == 1 {
544544
// No handle found. Check if a handle for this path + a
545545
// trailing slash exists for TSR recommendation
546546
n = n.children[0]
547547
value.tsr = (n.path == "/" && n.handlers != nil) || (n.path == "" && n.indices == "/")
548548
}
549-
return
549+
return value
550550

551551
case catchAll:
552552
// Save param value
@@ -578,7 +578,7 @@ walk: // Outer loop for walking the tree
578578

579579
value.handlers = n.handlers
580580
value.fullPath = n.fullPath
581-
return
581+
return value
582582

583583
default:
584584
panic("invalid node type")
@@ -609,20 +609,20 @@ walk: // Outer loop for walking the tree
609609
// Check if this node has a handle registered.
610610
if value.handlers = n.handlers; value.handlers != nil {
611611
value.fullPath = n.fullPath
612-
return
612+
return value
613613
}
614614

615615
// If there is no handle for this route, but this route has a
616616
// wildcard child, there must be a handle for this path with an
617617
// additional trailing slash
618618
if path == "/" && n.wildChild && n.nType != root {
619619
value.tsr = true
620-
return
620+
return value
621621
}
622622

623623
if path == "/" && n.nType == static {
624624
value.tsr = true
625-
return
625+
return value
626626
}
627627

628628
// No handle found. Check if a handle for this path + a
@@ -632,11 +632,11 @@ walk: // Outer loop for walking the tree
632632
n = n.children[i]
633633
value.tsr = (len(n.path) == 1 && n.handlers != nil) ||
634634
(n.nType == catchAll && n.children[0].handlers != nil)
635-
return
635+
return value
636636
}
637637
}
638638

639-
return
639+
return value
640640
}
641641

642642
// Nothing found. We can recommend to redirect to the same URL with an
@@ -662,7 +662,7 @@ walk: // Outer loop for walking the tree
662662
}
663663
}
664664

665-
return
665+
return value
666666
}
667667
}
668668

0 commit comments

Comments
 (0)