1
0
Fork 0
mirror of https://github.com/emojisum/emojisum.git synced 2025-08-03 05:40:27 +00:00

main: vet, lint, and travis

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2016-12-13 13:18:58 -05:00
parent a70422cd0c
commit 0c995c4059
Signed by: vbatts
GPG key ID: 10937E57733F1362
2 changed files with 25 additions and 2 deletions

View file

@ -49,7 +49,7 @@ func run() error {
fmt.Printf("%s(%s)= ", hash, name)
emoji.Println(str)
}
return nil
// never gets here because of the return on EOF or err
}
if *flParseCoreUtils {
buf := bufio.NewReader(os.Stdin)
@ -71,7 +71,7 @@ func run() error {
emoji.Print(str)
fmt.Printf(" %s\n", name)
}
return nil
// never gets here because of the return on EOF or err
}
// Otherwise do the checksum ourselves
@ -135,6 +135,7 @@ func parseOpenSSL(line string) (hash, filename string, sum []byte, err error) {
return chunksprime[0], chunksprime[1], sum, nil
}
// ErrNotOpenSSLLine when the line to parse is not formated like an OpenSSL checksum line
var ErrNotOpenSSLLine = errors.New("not an openssl checksum line")
/*
@ -156,8 +157,10 @@ func parseCoreUtils(line string) (filename string, sum []byte, err error) {
return chunks[1], sum, nil
}
// ErrNotCoreUtilsLine when the line to parse is not formated like a coreutils checksum line
var ErrNotCoreUtilsLine = errors.New("not a coreutils checksum line")
// Sum is a basic wrapper around crypto/sha1
func Sum(r io.Reader) ([]byte, error) {
h := sha1.New()
if _, err := io.Copy(h, r); err != nil {