1
1
mirror of https://github.com/goreleaser/nfpm synced 2024-11-19 03:25:08 +01:00

style: deb: simplified code a little

This commit is contained in:
Carlos Alexandro Becker 2018-02-25 13:00:42 -03:00
parent 6760f1586a
commit e4f8dde4bc
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940

@ -5,7 +5,6 @@ import (
"archive/tar"
"bytes"
"compress/gzip"
"encoding/hex"
// #nosec
"crypto/md5"
"fmt"
@ -133,8 +132,7 @@ func copyToTarAndDigest(tarw *tar.Writer, md5w io.Writer, now time.Time, src, ds
if _, err := io.Copy(tarw, io.TeeReader(file, digest)); err != nil {
return 0, errors.Wrap(err, "failed to copy")
}
var hash = hex.EncodeToString(digest.Sum(nil))
if _, err := fmt.Fprintf(md5w, "%s %s\n", hash, header.Name[1:]); err != nil {
if _, err := fmt.Fprintf(md5w, "%x %s\n", digest.Sum(nil), header.Name[1:]); err != nil {
return 0, errors.Wrap(err, "failed to write md5")
}
return info.Size(), nil