1
0
Fork 1
mirror of https://github.com/vbatts/tar-split.git synced 2024-11-15 12:58:38 +00:00

archive/tar: linting errors

I intend to not make changes to this `archive/tar` that aren't from
upstream, or are not directly related to the usage by this project...

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2023-03-25 20:20:49 -04:00
parent 516158dbfb
commit bc1624cbfc
Signed by: vbatts
GPG key ID: E30EFAA812C6E5ED
2 changed files with 9 additions and 7 deletions

View file

@ -41,7 +41,7 @@ type fileReader interface {
// RawBytes accesses the raw bytes of the archive, apart from the file payload itself. // RawBytes accesses the raw bytes of the archive, apart from the file payload itself.
// This includes the header and padding. // This includes the header and padding.
// //
// This call resets the current rawbytes buffer // # This call resets the current rawbytes buffer
// //
// Only when RawAccounting is enabled, otherwise this returns nil // Only when RawAccounting is enabled, otherwise this returns nil
func (tr *Reader) RawBytes() []byte { func (tr *Reader) RawBytes() []byte {
@ -126,7 +126,9 @@ func (tr *Reader) next() (*Header, error) {
return nil, err return nil, err
} }
if hdr.Typeflag == TypeXGlobalHeader { if hdr.Typeflag == TypeXGlobalHeader {
mergePAX(hdr, paxHdrs) if err = mergePAX(hdr, paxHdrs); err != nil {
return nil, err
}
return &Header{ return &Header{
Name: hdr.Name, Name: hdr.Name,
Typeflag: hdr.Typeflag, Typeflag: hdr.Typeflag,
@ -381,9 +383,9 @@ func parsePAX(r io.Reader) (map[string]string, error) {
// header in case further processing is required. // header in case further processing is required.
// //
// The err will be set to io.EOF only when one of the following occurs: // The err will be set to io.EOF only when one of the following occurs:
// * Exactly 0 bytes are read and EOF is hit. // - Exactly 0 bytes are read and EOF is hit.
// * Exactly 1 block of zeros is read and EOF is hit. // - Exactly 1 block of zeros is read and EOF is hit.
// * At least 2 blocks of zeros are read. // - At least 2 blocks of zeros are read.
func (tr *Reader) readHeader() (*Header, *block, error) { func (tr *Reader) readHeader() (*Header, *block, error) {
// Two blocks of zero bytes marks the end of the archive. // Two blocks of zero bytes marks the end of the archive.
n, err := io.ReadFull(tr.r, tr.blk[:]) n, err := io.ReadFull(tr.r, tr.blk[:])

View file

@ -833,8 +833,8 @@ func Benchmark(b *testing.B) {
// Write the archive to a byte buffer. // Write the archive to a byte buffer.
tw := NewWriter(&buf) tw := NewWriter(&buf)
for _, file := range v.files { for _, file := range v.files {
tw.WriteHeader(file.hdr) _ = tw.WriteHeader(file.hdr)
tw.Write(file.body) _, _ = tw.Write(file.body)
} }
tw.Close() tw.Close()
b.Run(v.label, func(b *testing.B) { b.Run(v.label, func(b *testing.B) {