Skip to content

Commit

Permalink
Fix json output for no offsets error
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Dec 19, 2023
1 parent e788100 commit 803578b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func main() {
"data": err,
})
}
log.Fatalf("No offsets found for %s/%s (hash: %x)", noOffsetsErr.Version, noOffsetsErr.Arch, noOffsetsErr.Hash[:])
log.Fatalf("No offsets found for %s/%s (hash: %x)", noOffsetsErr.Version, noOffsetsErr.Arch, noOffsetsErr.Hash)
return
}
panic(err)
Expand Down
10 changes: 5 additions & 5 deletions nac/nac.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ func sha256sum(path string) (hash [32]byte, err error) {
}

type NoOffsetsError struct {
Hash [32]byte `json:"hash"`
Version string `json:"version"`
Arch string `json:"arch"`
Hash []byte `json:"hash"`
Version string `json:"version"`
Arch string `json:"arch"`
}

func (err NoOffsetsError) Error() string {
return fmt.Sprintf("no offsets for %s/%s (hash: %x)", err.Version, err.Arch, err.Hash[:])
return fmt.Sprintf("no offsets for %s/%s (hash: %x)", err.Version, err.Arch, err.Hash)
}

func Load() error {
Expand All @@ -58,7 +58,7 @@ func Load() error {
}
if offs.ReferenceSymbol == "" {
return NoOffsetsError{
Hash: hash,
Hash: hash[:],
Version: versions.Current.SoftwareVersion,
Arch: runtime.GOARCH,
}
Expand Down

0 comments on commit 803578b

Please sign in to comment.