Skip to content

Commit

Permalink
fix: add newline to end of error messages (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed Aug 17, 2023
1 parent e184648 commit ae40566
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/database/zip.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (db *ZipDB) fetchZip() ([]byte, error) {
err := json.Unmarshal(cacheContent, &cache)

if err != nil {
_, _ = fmt.Fprintf(os.Stderr, "Failed to parse cache from %s: %v", cachePath, err)
_, _ = fmt.Fprintf(os.Stderr, "Failed to parse cache from %s: %v\n", cachePath, err)
}
}

Expand Down Expand Up @@ -119,7 +119,7 @@ func (db *ZipDB) fetchZip() ([]byte, error) {
err = os.WriteFile(cachePath, cacheContents, 0644)

if err != nil {
_, _ = fmt.Fprintf(os.Stderr, "Failed to write cache to %s: %v", cachePath, err)
_, _ = fmt.Fprintf(os.Stderr, "Failed to write cache to %s: %v\n", cachePath, err)
}
}

Expand All @@ -131,23 +131,23 @@ func (db *ZipDB) fetchZip() ([]byte, error) {
func (db *ZipDB) loadZipFile(zipFile *zip.File) {
file, err := zipFile.Open()
if err != nil {
_, _ = fmt.Fprintf(os.Stderr, "Could not read %s: %v", zipFile.Name, err)
_, _ = fmt.Fprintf(os.Stderr, "Could not read %s: %v\n", zipFile.Name, err)

return
}
defer file.Close()

content, err := io.ReadAll(file)
if err != nil {
_, _ = fmt.Fprintf(os.Stderr, "Could not read %s: %v", zipFile.Name, err)
_, _ = fmt.Fprintf(os.Stderr, "Could not read %s: %v\n", zipFile.Name, err)

return
}

var osv OSV

if err := json.Unmarshal(content, &osv); err != nil {
_, _ = fmt.Fprintf(os.Stderr, "%s is not a valid JSON file: %v", zipFile.Name, err)
_, _ = fmt.Fprintf(os.Stderr, "%s is not a valid JSON file: %v\n", zipFile.Name, err)

return
}
Expand Down

0 comments on commit ae40566

Please sign in to comment.