Skip to content

Commit 097ec15

Browse files
committed
Fix gosec
1 parent 67cbbc9 commit 097ec15

File tree

7 files changed

+10
-3
lines changed

7 files changed

+10
-3
lines changed

t-rec.gif

827 KB
Loading

t-rec.mp4

306 KB
Binary file not shown.

t-rec_1.gif

555 KB
Loading

t-rec_1.mp4

207 KB
Binary file not shown.

t-rec_2.gif

671 KB
Loading

t-rec_2.mp4

263 KB
Binary file not shown.

ui/s3hub/command.go

+10-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ package s3hub
22

33
import (
44
"context"
5-
"math/rand"
5+
"crypto/rand"
6+
"math/big"
67
"time"
78

89
tea "github.com/charmbracelet/bubbletea"
@@ -36,8 +37,14 @@ type deleteS3BucketMsg struct {
3637

3738
// deleteS3BucketCmd deletes the S3 bucket.
3839
func deleteS3BucketCmd(ctx context.Context, app *di.S3App, bucket model.Bucket) tea.Cmd {
39-
d := time.Millisecond * time.Duration(rand.Intn(500)) //nolint:gosec
40-
return tea.Tick(d, func(t time.Time) tea.Msg {
40+
d, err := rand.Int(rand.Reader, big.NewInt(500))
41+
if err != nil {
42+
// エラーのハンドリング
43+
return tea.Quit
44+
}
45+
delay := time.Millisecond * time.Duration(d.Int64())
46+
47+
return tea.Tick(delay, func(t time.Time) tea.Msg {
4148
_, err := app.S3BucketDeleter.DeleteS3Bucket(ctx, &usecase.S3BucketDeleterInput{
4249
Bucket: bucket,
4350
})

0 commit comments

Comments
 (0)