1
0
Fork 0
tar-split/archive/tar
Joe Tsai 2c3c708698 archive/tar: centralize all information about tar header format
The Reader and Writer have hard-coded constants regarding the
offsets and lengths of certain fields in the tar format sprinkled
all over. This makes it harder to verify that the offsets are
correct since a reviewer would need to search for them throughout
the code. Instead, all information about the layout of header
fields should be centralized in one single file. This has the
advantage of being both centralized, and also acting as a form
of documentation about the header struct format.

This method was chosen over using "encoding/binary" since that
method would cause an allocation of a header struct every time
binary.Read was called. This method causes zero allocations and
its logic is no longer than if structs were declared.

Updates #12594

Change-Id: Ic7a0565d2a2cd95d955547ace3b6dea2b57fab34
Reviewed-on: https://go-review.googlesource.com/14669
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-09-23 10:51:29 -04:00
..
testdata archive/tar: properly parse GNU base-256 encoding 2016-02-03 07:01:09 -05:00
common.go archive/tar: centralize all information about tar header format 2016-09-23 10:51:29 -04:00
example_test.go archive/tar: spell license correctly in example 2016-02-03 07:01:09 -05:00
format.go archive/tar: centralize all information about tar header format 2016-09-23 10:51:29 -04:00
reader.go archive/tar: centralize all information about tar header format 2016-09-23 10:51:29 -04:00
reader_test.go archive/tar: go1.3 and go1.4 compatibility 2016-02-15 09:38:46 -05:00
stat_atim.go archive/tar: adding from go as of a9dddb53f 2015-02-11 14:08:03 +01:00
stat_atimespec.go archive/tar: adding from go as of a9dddb53f 2015-02-11 14:08:03 +01:00
stat_unix.go archive/tar: don't treat multiple file system links as a tar hardlink 2015-08-21 00:15:22 -04:00
tar_test.go archive/tar: move round-trip reading into common os file 2015-08-21 00:15:22 -04:00
writer.go archive/tar: centralize all information about tar header format 2016-09-23 10:51:29 -04:00
writer_test.go archive/tar: centralize all information about tar header format 2016-09-23 10:51:29 -04:00