From 76a8e3b133bef07ff6a0909cb5b74a6e3d382483 Mon Sep 17 00:00:00 2001 From: Klaus Mueller Date: Fri, 5 Apr 2024 20:59:52 +0200 Subject: [PATCH] As of Go 1.20 there is no reason to call Seed with a random value https://pkg.go.dev/math/rand --- README.md | 3 +++ index.html | 2 +- msgsplit.go | 13 ------------- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 9e7af87..4a08e9f 100644 --- a/README.md +++ b/README.md @@ -50,11 +50,14 @@ If the hyperlink gets stolen, this message is disclosed. ## Build +golang>1.20 is required + ``` CGO_ENABLED=0 go build ./msgsplit.go ``` ## Run + ``` ./msgsplit.go ``` diff --git a/index.html b/index.html index a83ff2c..415f15e 100644 --- a/index.html +++ b/index.html @@ -6,7 +6,7 @@ message split - +
diff --git a/msgsplit.go b/msgsplit.go index 974eb31..5bbfe45 100644 --- a/msgsplit.go +++ b/msgsplit.go @@ -4,22 +4,9 @@ import ( "fmt" "os" "net/http" - crypto_rand "crypto/rand" - "encoding/binary" math_rand "math/rand" ) -// seed rand -// wanted to use https://github.com/google/uuid , but modules are a bigger threat -// from https://stackoverflow.com/a/54491783/2248997 -func init() { - var b [8]byte - _, err := crypto_rand.Read(b[:]) - if err != nil { - panic("cannot seed math/rand package with cryptographically secure random number generator") - } - math_rand.Seed(int64(binary.LittleEndian.Uint64(b[:]))) -} func main() { // this is a wedged CRUD