mirror of
https://github.com/nezhahq/nezha.git
synced 2025-02-08 12:38:13 -05:00
🚨 fix: gosec lint
This commit is contained in:
parent
7d70d4c4df
commit
db32cdbfae
@ -4,8 +4,10 @@ import (
|
|||||||
"crypto/md5" // #nosec
|
"crypto/md5" // #nosec
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"io"
|
"io"
|
||||||
|
"log"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@ -96,11 +98,15 @@ func SplitIPAddr(v4v6Bundle string) (string, string, string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func IsDirEmpty(name string) (bool, error) {
|
func IsDirEmpty(name string) (bool, error) {
|
||||||
f, err := os.Open(name)
|
f, err := os.Open(filepath.Clean(name))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
defer f.Close()
|
defer func() {
|
||||||
|
if err := f.Close(); err != nil {
|
||||||
|
log.Printf("Error closing file: %s\n", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
_, err = f.Readdirnames(1)
|
_, err = f.Readdirnames(1)
|
||||||
if err == io.EOF {
|
if err == io.EOF {
|
||||||
|
Loading…
Reference in New Issue
Block a user