Skip to content

Commit ec42110

Browse files
committed
chore: introduce linters and remove unused code in file handling functions
- Add `gosec` and `revive` linters - Remove unnecessary argument from `Readdir` function - Remove unused `err` variable in `defaultHandleRecovery` function Signed-off-by: appleboy <[email protected]>
1 parent fe989b6 commit ec42110

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

.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)