Skip to content

Commit

Permalink
mantle/kola: remove rand.Seed()
Browse files Browse the repository at this point in the history
This is to appease golangci-lint:

```
Error: SA1019: rand.Seed has been deprecated since Go 1.20 and an alternative
has been available since Go 1.0: As of Go 1.20 there is no reason to call Seed
with a random value. Programs that call Seed with a known value to get a
specific sequence of results should use New(NewSource(seed)) to obtain a local
random generator.  (staticcheck)
```

According to https://pkg.go.dev/math/rand#Seed "If Seed is not called, the
generator is seeded randomly at program startup." so I think it's safe to
just drop it.
  • Loading branch information
dustymabe committed Sep 13, 2024
1 parent 8c376a3 commit aeb3423
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions mantle/cmd/kola/kola.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@ package main
import (
"encoding/json"
"fmt"
"math/rand"
"net/http"
"os"
"path/filepath"
"regexp"
"sort"
"strings"
"text/tabwriter"
"time"

"github.com/coreos/pkg/capnslog"
"github.com/pkg/errors"
Expand Down Expand Up @@ -160,8 +158,6 @@ func init() {
}

func main() {
// initialize global state
rand.Seed(time.Now().UnixNano())
cli.Execute(root)
}

Expand Down

0 comments on commit aeb3423

Please sign in to comment.