From 6aafdb22cddb0b237e5734d42ba3c27c58bd9a16 Mon Sep 17 00:00:00 2001 From: Meredith Lancaster Date: Mon, 8 May 2023 10:32:59 -0600 Subject: [PATCH] pr feedback Signed-off-by: Meredith Lancaster --- pkg/tests/build_test_data.go | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/pkg/tests/build_test_data.go b/pkg/tests/build_test_data.go index 9d8df044..03ba974a 100644 --- a/pkg/tests/build_test_data.go +++ b/pkg/tests/build_test_data.go @@ -19,8 +19,6 @@ import ( "crypto" "encoding/base64" "encoding/json" - "fmt" - "io" "math/big" "testing" @@ -29,21 +27,8 @@ import ( ) func createBase64EncodedArtifactHash(artifact []byte, hash crypto.Hash) (string, error) { - r := bytes.NewReader(artifact) h := hash.New() - - b := make([]byte, h.Size()) - for { - n, err := r.Read(b) - if err == io.EOF { - break - } - - _, err = h.Write(b[:n]) - if err != nil { - return "", fmt.Errorf("failed to create hash") - } - } + h.Write(artifact) artifactHash := h.Sum(nil) return base64.StdEncoding.EncodeToString(artifactHash), nil