From 9a8660456478fabb2cf1f67e1a279587c5b584cc Mon Sep 17 00:00:00 2001 From: mr Date: Mon, 18 Nov 2024 15:16:58 +0100 Subject: [PATCH] test --- main.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index af906b0..fe2bbc4 100644 --- a/main.go +++ b/main.go @@ -68,13 +68,13 @@ func generateSelfPeer() error { // check if peer already exists p := oclib.Search(nil, strconv.Itoa(peer.SELF.EnumIndex()), oclib.LibDataEnum(oclib.PEER)) file := "" + f, err := os.ReadFile(conf.GetConfig().PublicKeyPath) + if err != nil { + return err + } + file = string(f) if len(p.Data) > 0 { // check public key with the one in the database - f, err := os.ReadFile(conf.GetConfig().PublicKeyPath) - if err != nil { - return err - } - file = string(f) // compare the public key from file with the one in the database if !strings.Contains(file, p.Data[0].(*peer.Peer).PublicKey) { return errors.New("public key is different from the one in the database")