File tree 2 files changed +17
-13
lines changed 2 files changed +17
-13
lines changed Original file line number Diff line number Diff line change @@ -7,12 +7,12 @@ require (
7
7
github.com/admpub/fsnotify v1.7.0
8
8
github.com/admpub/pp v0.0.7
9
9
github.com/francoispqt/gojay v1.2.13
10
- github.com/goccy/go-json v0.10.3
10
+ github.com/goccy/go-json v0.10.4
11
11
github.com/hashicorp/go-version v1.7.0
12
12
github.com/json-iterator/go v1.1.12
13
13
github.com/stretchr/testify v1.9.0
14
- golang.org/x/crypto v0.27 .0
15
- golang.org/x/text v0.18 .0
14
+ golang.org/x/crypto v0.31 .0
15
+ golang.org/x/text v0.21 .0
16
16
)
17
17
18
18
require (
@@ -22,6 +22,6 @@ require (
22
22
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
23
23
github.com/modern-go/reflect2 v1.0.2 // indirect
24
24
github.com/pmezard/go-difflib v1.0.0 // indirect
25
- golang.org/x/sys v0.25 .0 // indirect
25
+ golang.org/x/sys v0.28 .0 // indirect
26
26
gopkg.in/yaml.v3 v3.0.1 // indirect
27
27
)
Original file line number Diff line number Diff line change @@ -263,19 +263,23 @@ func RandomCreateBytes(n int, alphabets ...byte) []byte {
263
263
rd = NewRand ()
264
264
randby = true
265
265
}
266
- for i , b := range bytes {
267
- if len (alphabets ) == 0 {
266
+ if len (alphabets ) == 0 {
267
+ size := len (alphanum )
268
+ for i , b := range bytes {
268
269
if randby {
269
- bytes [i ] = alphanum [rd .Intn (len ( alphanum ) )]
270
+ bytes [i ] = alphanum [rd .Intn (size )]
270
271
} else {
271
- bytes [i ] = alphanum [b % byte (len ( alphanum ) )]
272
+ bytes [i ] = alphanum [b % byte (size )]
272
273
}
274
+ }
275
+ return bytes
276
+ }
277
+ size := len (alphabets )
278
+ for i , b := range bytes {
279
+ if randby {
280
+ bytes [i ] = alphabets [rd .Intn (size )]
273
281
} else {
274
- if randby {
275
- bytes [i ] = alphabets [rd .Intn (len (alphabets ))]
276
- } else {
277
- bytes [i ] = alphabets [b % byte (len (alphabets ))]
278
- }
282
+ bytes [i ] = alphabets [b % byte (size )]
279
283
}
280
284
}
281
285
return bytes
You can’t perform that action at this time.
0 commit comments