fix: 修复 golangci-lint gosimple/ineffassign/staticcheck 错误
This commit is contained in:
+1
-1
@@ -192,7 +192,7 @@ func (api WebTerminalApi) SshEndpoint(c echo.Context) error {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return err
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (api WebTerminalApi) SshMonitorEndpoint(c echo.Context) error {
|
func (api WebTerminalApi) SshMonitorEndpoint(c echo.Context) error {
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ func (service sessionService) Decrypt(item *model.Session) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (service sessionService) renderBoolToStr(b *bool) string {
|
func (service sessionService) renderBoolToStr(b *bool) string {
|
||||||
if *(b) == true {
|
if *b {
|
||||||
return "1"
|
return "1"
|
||||||
}
|
}
|
||||||
return "0"
|
return "0"
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ var Encoder = Bcrypt{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GenPassword() string {
|
func GenPassword() string {
|
||||||
rand.Seed(time.Now().UnixNano())
|
r := rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||||
digits := "0123456789"
|
digits := "0123456789"
|
||||||
specials := "~=+%^*/()[]{}/!@#$?|"
|
specials := "~=+%^*/()[]{}/!@#$?|"
|
||||||
all := "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +
|
all := "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +
|
||||||
@@ -32,12 +32,12 @@ func GenPassword() string {
|
|||||||
digits + specials
|
digits + specials
|
||||||
length := 8
|
length := 8
|
||||||
buf := make([]byte, length)
|
buf := make([]byte, length)
|
||||||
buf[0] = digits[rand.Intn(len(digits))]
|
buf[0] = digits[r.Intn(len(digits))]
|
||||||
buf[1] = specials[rand.Intn(len(specials))]
|
buf[1] = specials[r.Intn(len(specials))]
|
||||||
for i := 2; i < length; i++ {
|
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]
|
buf[i], buf[j] = buf[j], buf[i]
|
||||||
})
|
})
|
||||||
return string(buf)
|
return string(buf)
|
||||||
|
|||||||
Reference in New Issue
Block a user