From 7588000af4ea789bec6abc6d25a648c84116544d Mon Sep 17 00:00:00 2001 From: GnomeZworc Date: Thu, 14 Mar 2024 19:54:15 +0100 Subject: [PATCH] v1.0.0: lint: fix deprecated library Signed-off-by: GnomeZworc --- lib/initBiscuit.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/initBiscuit.go b/lib/initBiscuit.go index 71785d5..5f63585 100644 --- a/lib/initBiscuit.go +++ b/lib/initBiscuit.go @@ -3,6 +3,7 @@ package lib import ( "crypto/ed25519" "crypto/rand" + "io" "io/ioutil" "os" "time" @@ -53,12 +54,21 @@ func InitGlobalBiscuit() error { break } } - var err error - PrivateKey, err = ioutil.ReadFile(filePrivateKey) + file, err := os.Open(filePrivateKey) if err != nil { return err } - PublicKey, err = ioutil.ReadFile(filePublicKey) + defer file.Close() + PrivateKey, err = io.ReadAll(file) + if err != nil { + return err + } + file, err = os.Open(filePublicKey) + if err != nil { + return err + } + defer file.Close() + PublicKey, err = io.ReadAll(file) if err != nil { return err }