mirror of
https://github.com/emojisum/emojisum.git
synced 2025-02-09 02:43:32 +00:00
commit
a2456feb8f
2 changed files with 25 additions and 2 deletions
20
.travis.yml
Normal file
20
.travis.yml
Normal 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 .
|
7
main.go
7
main.go
|
@ -49,7 +49,7 @@ func run() error {
|
||||||
fmt.Printf("%s(%s)= ", hash, name)
|
fmt.Printf("%s(%s)= ", hash, name)
|
||||||
emoji.Println(str)
|
emoji.Println(str)
|
||||||
}
|
}
|
||||||
return nil
|
// never gets here because of the return on EOF or err
|
||||||
}
|
}
|
||||||
if *flParseCoreUtils {
|
if *flParseCoreUtils {
|
||||||
buf := bufio.NewReader(os.Stdin)
|
buf := bufio.NewReader(os.Stdin)
|
||||||
|
@ -71,7 +71,7 @@ func run() error {
|
||||||
emoji.Print(str)
|
emoji.Print(str)
|
||||||
fmt.Printf(" %s\n", name)
|
fmt.Printf(" %s\n", name)
|
||||||
}
|
}
|
||||||
return nil
|
// never gets here because of the return on EOF or err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise do the checksum ourselves
|
// 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
|
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")
|
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
|
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")
|
var ErrNotCoreUtilsLine = errors.New("not a coreutils checksum line")
|
||||||
|
|
||||||
|
// Sum is a basic wrapper around crypto/sha1
|
||||||
func Sum(r io.Reader) ([]byte, error) {
|
func Sum(r io.Reader) ([]byte, error) {
|
||||||
h := sha1.New()
|
h := sha1.New()
|
||||||
if _, err := io.Copy(h, r); err != nil {
|
if _, err := io.Copy(h, r); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue