FAQ
dsymonds, I just have one question about ReadAll(tr) vs ReadAll(r).


https://codereview.appspot.com/6700047/diff/18001/src/pkg/archive/tar/reader.go
File src/pkg/archive/tar/reader.go (right):

https://codereview.appspot.com/6700047/diff/18001/src/pkg/archive/tar/reader.go#newcode71
src/pkg/archive/tar/reader.go:71: // We have a PAX extended header. See
http://pubs.opengroup.org/onlinepubs/009604599/utilities/pax.html
On 2012/10/22 06:29:14, dsymonds wrote:
no need to repeat the reference here.
// PAX extended header
Done.

https://codereview.appspot.com/6700047/diff/18001/src/pkg/archive/tar/reader.go#newcode198
src/pkg/archive/tar/reader.go:198: // parsePAX parses PAX headers from
tr following the rules outlined
On 2012/10/22 06:29:14, dsymonds wrote:
// parsePAX parses a PAX header.
No need for extra detail; it's not hard to find this in pax.html. No need to
spell out the particular error return; nothing is distinguishing that
error.

Done.

https://codereview.appspot.com/6700047/diff/18001/src/pkg/archive/tar/reader.go#newcode201
src/pkg/archive/tar/reader.go:201: func parsePAX(tr io.Reader)
(map[string]string, error) {
On 2012/10/22 06:29:14, dsymonds wrote:
tr -> r
("tr" here returns to the local Reader type, not io.Reader)
I actually think this is what I want. ReadAll(tr) gives me the contents
of the extended header, which is put in the body of the pax record.
wouldn't ReadlAll(r) read the underlying reader until EOF?

https://codereview.appspot.com/6700047/diff/18001/src/pkg/archive/tar/reader.go#newcode207
src/pkg/archive/tar/reader.go:207: // We are looking for records of the
type:
On 2012/10/22 06:29:14, dsymonds wrote:
This is a bit confusing.
// Each record is constructed as
// "%d %s=%s\n", length, keyword, value
(that is much closer to what pax.html says)
Done.

https://codereview.appspot.com/6700047/diff/18001/src/pkg/archive/tar/reader.go#newcode212
src/pkg/archive/tar/reader.go:212: if len(buf) == 0 {
On 2012/10/22 06:29:14, dsymonds wrote:
make this the loop condition.
Done.

https://codereview.appspot.com/6700047/diff/18001/src/pkg/archive/tar/reader.go#newcode217
src/pkg/archive/tar/reader.go:217: pos = bytes.IndexByte(buf, ' ')
On 2012/10/22 06:29:14, dsymonds wrote:
pos -> sp
Done.

https://codereview.appspot.com/6700047/diff/18001/src/pkg/archive/tar/reader.go#newcode222
src/pkg/archive/tar/reader.go:222: length, err :=
strconv.ParseInt(string(buf[:pos]), 10, 0)
On 2012/10/22 06:29:14, dsymonds wrote:
length -> n
Done.

https://codereview.appspot.com/6700047/diff/18001/src/pkg/archive/tar/reader.go#newcode228
src/pkg/archive/tar/reader.go:228: record := buf[pos+1 : int(length)-1]
On 2012/10/22 06:29:14, dsymonds wrote:
slice off the record and shrink buf in the same step to make it
clearer what the
operation is.
var rec []byte
rec, buf = buf[sp+1:int(n)-1], buf[n:]
(are you sure you need this int cast?)
Done.

https://codereview.appspot.com/6700047/

Search Discussions

  • Shanemhansen at Oct 23, 2012 at 3:16 am
    Hello golang-dev@googlegroups.com, dsymonds@golang.org, dave@cheney.net,
    rogpeppe@gmail.com, remyoudompheng@gmail.com (cc:
    golang-dev@googlegroups.com),

    Please take another look.


    http://codereview.appspot.com/6700047/

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedOct 23, '12 at 2:54a
activeOct 23, '12 at 3:16a
posts2
users1
websitegolang.org

1 user in discussion

Shanemhansen: 2 posts

People

Translate

site design / logo © 2022 Grokbase