Skip to content

Commit

Permalink
compatible with go v1.20
Browse files Browse the repository at this point in the history
  • Loading branch information
bachue committed Oct 22, 2024
1 parent 95203cf commit 1666cc4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions iqshell/storage/object/operations/share.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bufio"
"context"
"encoding/json"
rand "math/rand/v2"
"math/rand"
"net/url"
"os"
"path/filepath"
Expand Down Expand Up @@ -71,7 +71,7 @@ func createShare(cfg *iqshell.Config, info *CreateShareInfo) error {
bytes := []byte(randomExtractCodeChars)
extractCodeBytes := make([]byte, 0, 6)
for i := 0; i < 6; i++ {
n := rand.IntN(len(bytes))
n := rand.Intn(len(bytes))

Check warning on line 74 in iqshell/storage/object/operations/share.go

View check run for this annotation

qiniu-x / golangci-lint

iqshell/storage/object/operations/share.go#L74

G404: Use of weak random number generator (math/rand or math/rand/v2 instead of crypto/rand) (gosec)
extractCodeBytes = append(extractCodeBytes, bytes[n])
}
info.ExtractCode = string(extractCodeBytes)
Expand Down

0 comments on commit 1666cc4

Please sign in to comment.