Skip to content

Commit

Permalink
Write errors to stderr and exit on fatal error
Browse files Browse the repository at this point in the history
  • Loading branch information
jonnystoten committed May 7, 2024
1 parent aca2868 commit 118ddd0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tools/key-verification/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,20 @@ func main() {
}
devices, err := os.ReadDir(pathToKeys)
if err != nil {
fmt.Println("Error reading directory:", err)
return
fmt.Fprintln(os.Stderr, "Error reading directory:", err)
os.Exit(1)
}
if len(devices) == 0 {
fmt.Println("No devices found in the directory:", pathToKeys)
return
fmt.Fprintln(os.Stderr, "No devices found in the directory:", pathToKeys)
os.Exit(1)
}
for _, device := range devices {
if device.IsDir() {
serial := device.Name()
path := filepath.Join(pathToKeys, serial)
err := verifyDeviceAttestation(serial, path)
if err != nil {
fmt.Println("Error verifying device attestation:", err)
fmt.Fprintln(os.Stderr, "Error verifying device attestation:", err)
continue
}
fmt.Println("Device attestation verified for:", serial)
Expand Down

0 comments on commit 118ddd0

Please sign in to comment.