Skip to content

Commit

Permalink
Fix gosec
Browse files Browse the repository at this point in the history
  • Loading branch information
nao1215 committed Jan 14, 2024
1 parent 67cbbc9 commit 097ec15
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 3 deletions.
Binary file added t-rec.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added t-rec.mp4
Binary file not shown.
Binary file added t-rec_1.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added t-rec_1.mp4
Binary file not shown.
Binary file added t-rec_2.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added t-rec_2.mp4
Binary file not shown.
13 changes: 10 additions & 3 deletions ui/s3hub/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package s3hub

import (
"context"
"math/rand"
"crypto/rand"
"math/big"
"time"

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

// deleteS3BucketCmd deletes the S3 bucket.
func deleteS3BucketCmd(ctx context.Context, app *di.S3App, bucket model.Bucket) tea.Cmd {
d := time.Millisecond * time.Duration(rand.Intn(500)) //nolint:gosec
return tea.Tick(d, func(t time.Time) tea.Msg {
d, err := rand.Int(rand.Reader, big.NewInt(500))
if err != nil {
// エラーのハンドリング
return tea.Quit
}
delay := time.Millisecond * time.Duration(d.Int64())

return tea.Tick(delay, func(t time.Time) tea.Msg {
_, err := app.S3BucketDeleter.DeleteS3Bucket(ctx, &usecase.S3BucketDeleterInput{
Bucket: bucket,
})
Expand Down

0 comments on commit 097ec15

Please sign in to comment.