mirror of
https://github.com/slsa-framework/slsa-verifier.git
synced 2026-05-19 06:56:53 +00:00
Never panic, always return error (#199)
* Update main.go Signed-off-by: laurentsimon <64505099+laurentsimon@users.noreply.github.com> * Update main.go Signed-off-by: laurentsimon <64505099+laurentsimon@users.noreply.github.com>
This commit is contained in:
@@ -7,7 +7,6 @@ import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/slsa-framework/slsa-verifier/options"
|
||||
@@ -91,7 +90,7 @@ func runVerify(artifactPath, provenancePath, source, branch string,
|
||||
) ([]byte, string, error) {
|
||||
f, err := os.Open(artifactPath)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
return nil, "", err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
@@ -102,7 +101,7 @@ func runVerify(artifactPath, provenancePath, source, branch string,
|
||||
|
||||
h := sha256.New()
|
||||
if _, err := io.Copy(h, f); err != nil {
|
||||
log.Panic(err)
|
||||
return nil, "", err
|
||||
}
|
||||
artifactHash := hex.EncodeToString(h.Sum(nil))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user