Skip to content

Commit

Permalink
move rand.Seed to main function
Browse files Browse the repository at this point in the history
  • Loading branch information
emosbaugh committed Sep 3, 2020
1 parent 80c3648 commit 39c0dc4
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
9 changes: 8 additions & 1 deletion kotsadm/cmd/kotsadm/main.go
@@ -1,7 +1,14 @@
package main

import "github.com/replicatedhq/kots/kotsadm/cmd/kotsadm/cli"
import (
"math/rand"
"time"

"github.com/replicatedhq/kots/kotsadm/cmd/kotsadm/cli"
)

func main() {
rand.Seed(time.Now().UnixNano())

cli.InitAndExecute()
}
3 changes: 3 additions & 0 deletions kotsadm/kurl_proxy/cmd/main.go
Expand Up @@ -9,6 +9,7 @@ import (
"fmt"
"io/ioutil"
"log"
"math/rand"
"net"
"net/http"
"net/http/httputil"
Expand Down Expand Up @@ -39,6 +40,8 @@ type cert struct {
func main() {
log.Printf("Commit %s\n", os.Getenv("COMMIT"))

rand.Seed(time.Now().UnixNano())

upstreamOrigin := os.Getenv("UPSTREAM_ORIGIN")
tlsSecretName := os.Getenv("TLS_SECRET_NAME")
namespace := os.Getenv("NAMESPACE")
Expand Down
9 changes: 8 additions & 1 deletion kotsadm/operator/cmd/kotsadm-operator/main.go
@@ -1,7 +1,14 @@
package main

import "github.com/replicatedhq/kots/kotsadm/operator/cmd/kotsadm-operator/cli"
import (
"math/rand"
"time"

"github.com/replicatedhq/kots/kotsadm/operator/cmd/kotsadm-operator/cli"
)

func main() {
rand.Seed(time.Now().UnixNano())

cli.InitAndExecute()
}
5 changes: 0 additions & 5 deletions kotsadm/pkg/session/session.go
Expand Up @@ -3,7 +3,6 @@ package session
import (
"context"
"fmt"
"math/rand"
"os"
"strings"
"time"
Expand All @@ -18,10 +17,6 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client/config"
)

func init() {
rand.Seed(time.Now().UnixNano())
}

func Parse(signedToken string) (*types.Session, error) {
if signedToken == "" {
return nil, errors.New("missing token")
Expand Down

0 comments on commit 39c0dc4

Please sign in to comment.