From 2061dd382cecab2ff6ee7331c0d75bde861bfd55 Mon Sep 17 00:00:00 2001 From: andig Date: Sun, 25 Feb 2024 13:20:25 +0100 Subject: [PATCH] Revert "chore: upgrade standard packages" due to https://github.com/golangci/golangci-lint/issues/4415 This reverts commit ad0c6d5eb1363e2ba554c3bbb30aac07798171f9. --- hems/ocpp/ocpp.go | 4 ++-- provider/mqtt/client.go | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/hems/ocpp/ocpp.go b/hems/ocpp/ocpp.go index 8bb464f1d..dc9ce5bf8 100644 --- a/hems/ocpp/ocpp.go +++ b/hems/ocpp/ocpp.go @@ -2,7 +2,7 @@ package ocpp import ( "fmt" - "math/rand/v2" + "math/rand" "strings" "time" @@ -43,7 +43,7 @@ func New(conf map[string]interface{}, site site.API) (*OCPP, error) { if err == nil { cc.StationID = fmt.Sprintf("evcc-%s", strings.ToLower(id)) } else { - cc.StationID = fmt.Sprintf("evcc-%d", rand.Uint32()) + cc.StationID = fmt.Sprintf("evcc-%d", rand.Int31()) } log.DEBUG.Println("station id:", cc.StationID) } diff --git a/provider/mqtt/client.go b/provider/mqtt/client.go index fae0aa81d..e59324643 100644 --- a/provider/mqtt/client.go +++ b/provider/mqtt/client.go @@ -3,7 +3,7 @@ package mqtt import ( "crypto/tls" "fmt" - "math/rand/v2" + "math/rand" "strings" "sync" "sync/atomic" @@ -20,7 +20,8 @@ var Instance *Client // ClientID created unique mqtt client id func ClientID() string { - return fmt.Sprintf("evcc-%d", rand.Uint32()) + pid := rand.Int31() + return fmt.Sprintf("evcc-%d", pid) } // Config is the public configuration