diff --git a/archive/tar/reader.go b/archive/tar/reader.go index 7846c7f..94483fc 100644 --- a/archive/tar/reader.go +++ b/archive/tar/reader.go @@ -340,7 +340,7 @@ func mergePAX(hdr *Header, headers map[string]string) error { if err != nil { return err } - hdr.Size = int64(size) + hdr.Size = size default: if strings.HasPrefix(k, paxXattr) { if hdr.Xattrs == nil { @@ -380,7 +380,7 @@ func parsePAXTime(t string) (time.Time, error) { // Right truncate nano_buf = nano_buf[:maxNanoSecondIntSize] } - nanoseconds, err = strconv.ParseInt(string(nano_buf), 10, 0) + nanoseconds, err = strconv.ParseInt(nano_buf, 10, 0) if err != nil { return time.Time{}, err } @@ -418,14 +418,14 @@ func parsePAX(r io.Reader) (map[string]string, error) { } sbuf = residual - keyStr := string(key) + keyStr := key if keyStr == paxGNUSparseOffset || keyStr == paxGNUSparseNumBytes { // GNU sparse format 0.0 special key. Write to sparseMap instead of using the headers map. sparseMap.WriteString(value) sparseMap.Write([]byte{','}) } else { // Normal key. Set the value in the headers map. - headers[keyStr] = string(value) + headers[keyStr] = value } } if sparseMap.Len() != 0 { diff --git a/archive/tar/writer.go b/archive/tar/writer.go index 600ee4b..944b2d4 100644 --- a/archive/tar/writer.go +++ b/archive/tar/writer.go @@ -278,7 +278,7 @@ func (tw *Writer) writeHeader(hdr *Header, allowPax bool) error { return err } } - tw.nb = int64(hdr.Size) + tw.nb = hdr.Size tw.pad = (blockSize - (tw.nb % blockSize)) % blockSize _, tw.err = tw.w.Write(header)