Skip to content

Commit

Permalink
fix: lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
danilo-gemoli committed Sep 1, 2023
1 parent 066743f commit b6f07b1
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 10 deletions.
3 changes: 0 additions & 3 deletions experiment/gerrit-onboarder/onboarder.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
"path"
"regexp"
"strings"
"time"

"github.com/sirupsen/logrus"

Expand Down Expand Up @@ -465,8 +464,6 @@ func main() {
workDir = path.Join(workDir, getRepoClonedName(o.repo))
}

// Using math/rand instead of crypto/rand so we don't need to handle errors
rand.Seed(time.Now().UTC().UnixNano())
branchName := fmt.Sprintf("gerritOnboarding_%d", rand.Int())

if err = fetchMetaConfig(o.host, o.repo, branchName, workDir); err != nil {
Expand Down
1 change: 0 additions & 1 deletion gcsweb/cmd/gcsweb/gcsweb.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ func main() {
s := &server{storageClient: storageClient}

logrus.Info("Starting GCSWeb")
rand.Seed(time.Now().UTC().UnixNano())

// Canonicalize allowed buckets.
for i := range o.allowedBuckets {
Expand Down
4 changes: 3 additions & 1 deletion kubetest/kops.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ import (
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ec2"

cryptorand "crypto/rand"

"golang.org/x/crypto/ssh"

"k8s.io/test-infra/kubetest/e2e"
Expand Down Expand Up @@ -894,7 +896,7 @@ func setupGCEStateStore(projectId string) (*string, error) {
// gceBucketName generates a name for GCE state store bucket
func gceBucketName(projectId string) string {
b := make([]byte, 2)
rand.Read(b)
cryptorand.Read(b)
s := hex.EncodeToString(b)
return strings.Join([]string{projectId, "state", s}, "-")
}
4 changes: 0 additions & 4 deletions kubetest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"flag"
"fmt"
"log"
"math/rand"
"os"
"os/exec"
"os/signal"
Expand Down Expand Up @@ -280,9 +279,6 @@ func main() {
log.SetFlags(log.LstdFlags | log.Lshortfile)
log.Printf("Running kubetest version: %s\n", gitTag)

// Initialize global pseudo random generator. Initializing it to select random AWS Zones.
rand.Seed(time.Now().UnixNano())

pflag.CommandLine = pflag.NewFlagSet(os.Args[0], pflag.ContinueOnError)
o := defineFlags()
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
Expand Down
1 change: 0 additions & 1 deletion robots/commenter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ func run(c client, query, sort string, asc, random bool, commenter func(meta) (s
problems := []string{}
log.Printf("Found %d matches", len(issues))
if random {
rand.Seed(time.Now().UnixNano())
rand.Shuffle(len(issues), func(i, j int) {
issues[i], issues[j] = issues[j], issues[i]
})
Expand Down

0 comments on commit b6f07b1

Please sign in to comment.