fix: 修复 golangci-lint gosimple/ineffassign/staticcheck 错误

This commit is contained in:
2026-04-20 04:48:25 +08:00
parent aebdb5ce70
commit 5a5c652264
3 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -192,7 +192,7 @@ func (api WebTerminalApi) SshEndpoint(c echo.Context) error {
}
}
return err
return nil
}
func (api WebTerminalApi) SshMonitorEndpoint(c echo.Context) error {
+1 -1
View File
@@ -225,7 +225,7 @@ func (service sessionService) Decrypt(item *model.Session) error {
}
func (service sessionService) renderBoolToStr(b *bool) string {
if *(b) == true {
if *b {
return "1"
}
return "0"
+5 -5
View File
@@ -24,7 +24,7 @@ var Encoder = Bcrypt{
}
func GenPassword() string {
rand.Seed(time.Now().UnixNano())
r := rand.New(rand.NewSource(time.Now().UnixNano()))
digits := "0123456789"
specials := "~=+%^*/()[]{}/!@#$?|"
all := "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +
@@ -32,12 +32,12 @@ func GenPassword() string {
digits + specials
length := 8
buf := make([]byte, length)
buf[0] = digits[rand.Intn(len(digits))]
buf[1] = specials[rand.Intn(len(specials))]
buf[0] = digits[r.Intn(len(digits))]
buf[1] = specials[r.Intn(len(specials))]
for i := 2; i < length; i++ {
buf[i] = all[rand.Intn(len(all))]
buf[i] = all[r.Intn(len(all))]
}
rand.Shuffle(len(buf), func(i, j int) {
r.Shuffle(len(buf), func(i, j int) {
buf[i], buf[j] = buf[j], buf[i]
})
return string(buf)