Skip to content

Commit

Permalink
Added error
Browse files Browse the repository at this point in the history
  • Loading branch information
raspi committed Aug 3, 2020
1 parent f828aaf commit c0165b6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions update.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (ct checksumType) String() string {
// Update checksums to file(s)
// File must be in format
// <checksum> <file path>
func GetChecksumsFromFile(chtype checksumType, path string, fn func(fpath string) (url, arch, alias string)) (f Files) {
func GetChecksumsFromFile(chtype checksumType, path string, fn func(fpath string) (url, arch, alias string, err error)) (f Files, err error) {
f = make(Files)
lines, err := GetLinesFromFile(path)

Expand All @@ -65,7 +65,10 @@ func GetChecksumsFromFile(chtype checksumType, path string, fn func(fpath string
checksum := matches[1]
fname := matches[2]

url, arch, alias := fn(fname)
url, arch, alias, err := fn(fname)
if err != nil {
return f, err
}

if url == `` {
continue
Expand All @@ -85,7 +88,7 @@ func GetChecksumsFromFile(chtype checksumType, path string, fn func(fpath string
f[arch] = append(f[arch], newSource)
}

return f
return f, nil
}

// Read a file and split with new line separator
Expand Down

0 comments on commit c0165b6

Please sign in to comment.