Skip to content

Commit 7a528ab

Browse files
committed
chore: improve code quality with linting and signature changes
- Add `gosec` and `revive` linters to `gin.go` and `_test\.go` files in `.golangci.yml` - Change `Readdir` method signature in `neuteredReaddirFile` in `fs.go` - Remove unused `err` parameter in `defaultHandleRecovery` function in `recovery.go` Signed-off-by: appleboy <[email protected]>
1 parent fe989b6 commit 7a528ab

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

.github/workflows/gin.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Setup golangci-lint
2525
uses: golangci/[email protected]
2626
with:
27-
version: v1.48.0
27+
version: v1.52.2
2828
args: --verbose
2929
test:
3030
needs: lint

.golangci.yml

+6
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,9 @@ issues:
3737
- path: _test\.go
3838
linters:
3939
- gosec # security is not make sense in tests
40+
- path: gin.go
41+
linters:
42+
- gosec
43+
- linters:
44+
- revive
45+
path: _test\.go

fs.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func (fs onlyFilesFS) Open(name string) (http.File, error) {
3939
}
4040

4141
// Readdir overrides the http.File default implementation.
42-
func (f neuteredReaddirFile) Readdir(count int) ([]os.FileInfo, error) {
42+
func (f neuteredReaddirFile) Readdir(_ int) ([]os.FileInfo, error) {
4343
// this disables directory listing
4444
return nil, nil
4545
}

recovery.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ func CustomRecoveryWithWriter(out io.Writer, handle RecoveryFunc) HandlerFunc {
103103
}
104104
}
105105

106-
func defaultHandleRecovery(c *Context, err any) {
106+
func defaultHandleRecovery(c *Context, _ any) {
107107
c.AbortWithStatus(http.StatusInternalServerError)
108108
}
109109

0 commit comments

Comments
 (0)