1
0
Fork 0
mirror of https://github.com/emojisum/emojisum.git synced 2025-01-24 03:40:07 +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

20
.travis.yml Normal file
View file

@ -0,0 +1,20 @@
language: go
go:
- 1.7.4
- 1.6.3
sudo: false
before_install:
- git config --global url."https://".insteadOf git://
- go get -u github.com/golang/lint/golint
- mkdir -p $GOPATH/src/github.com/vbatts && ln -sf $(pwd) $GOPATH/src/github.com/vbatts/emojisum
- go get -d ./...
install: true
script:
- go vet ./...
- golint -set_exit_status ./...
- go test -v ./...
- go build .

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 {