Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: uci/copy-templates #116

Merged
merged 2 commits into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions flatfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,12 @@ var (
ErrInvalidKey = errors.New("key not supported by flatfs")
)

var (
r *rand.Rand
)

func init() {
rand.Seed(time.Now().UTC().UnixNano())
r = rand.New(rand.NewSource(time.Now().UTC().UnixNano()))
}

// Datastore implements the go-datastore Interface.
Expand Down Expand Up @@ -866,7 +870,7 @@ func folderSize(path string, deadline time.Time) (int64, initAccuracy, error) {
// randomize file order
// https://stackoverflow.com/a/42776696
for i := len(files) - 1; i > 0; i-- {
j := rand.Intn(i + 1)
j := r.Intn(i + 1)
files[i], files[j] = files[j], files[i]
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ require (
go.uber.org/zap v1.10.0 // indirect
)

go 1.19
go 1.20