go/src
Joe Tsai 9d3d370632 archive/tar: support reporting and selecting the format
The Reader and Writer are now at feature parity,
meaning that everything that can be parsed by the Reader,
can also be composed by the Writer.

This position enables us to support selection of the format
in a backwards compatible way, since it ensures that everything
that can be read can also be round-trip written.

As such, we add the following new API:
    type Format int
            const FormatUnknown Format = 0 ...
    type Header struct { ...; Format Format }

The new Header.Format field is populated by the Reader on the
best guess on what the format is. Note that the Reader is very liberal
in what it permits, so a hybrid TAR file using aspects of multiple
formats can still be decoded, but will be reported as FormatUnknown.

Even though Reader has full support for V7 and basic support for STAR,
it will still report those formats as unknown (and the constants for
those formats are not even exported). The reasons for this is because
the Writer has no support for V7 or STAR. Leaving it as unknown allows
the Writer to choose a format usually USTAR or GNU that can encode
the equivalent Header.

When writing, the Header.allowedFormats will take the Format field
into consideration if it is a known format.

Fixes #18710

Change-Id: I00980c475d067c6969d3414e1ff0224fdd89cd49
Reviewed-on: https://go-review.googlesource.com/58230
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-24 01:35:39 +00:00
..
archive archive/tar: support reporting and selecting the format 2017-08-24 01:35:39 +00:00
bufio Revert "bufio: make Reader.Peek invalidate Unreads" 2017-07-06 03:06:44 +00:00
builtin
bytes bytes: add examples for TrimLeft and TrimRight 2017-08-22 21:31:54 +00:00
cmd cmd/vet: diagnose xml/json tag with space after comma 2017-08-24 00:56:05 +00:00
compress
container
context
crypto crypto/x509: skip TestSystemRoots 2017-08-22 19:54:08 +00:00
database/sql all: fix easy-to-miss typos 2017-08-23 03:07:12 +00:00
debug all: unindent some big chunks of code 2017-08-18 06:59:48 +00:00
encoding encoding/xml: improve package based on the suggestions from metalinter 2017-08-24 00:55:59 +00:00
errors
expvar
flag flag: make default Usage prefer CommandLine's output over just os.Stderr 2017-08-08 01:47:47 +00:00
fmt fmt: add Stringer example 2017-08-16 18:02:42 +00:00
go go/doc: classify function returning slice of T as constructor 2017-08-22 08:09:42 +00:00
hash all: gofmt 2017-06-21 03:14:30 +00:00
html html: updated entity spec link 2017-08-08 04:29:35 +00:00
image image/gif: fix writeImageBlock with SubImages 2017-06-16 05:45:48 +00:00
index/suffixarray
internal all: fix easy-to-miss typos 2017-08-23 03:07:12 +00:00
io io: add example for Pipe 2017-08-22 19:42:20 +00:00
log log: adds a Logger Output method Example 2017-07-16 03:57:11 +00:00
math all: fix easy-to-miss typos 2017-08-23 03:07:12 +00:00
mime
net {net,os/user,plugin}: eliminate unnecessary C round-trips 2017-08-17 18:14:16 +00:00
os {net,os/user,plugin}: eliminate unnecessary C round-trips 2017-08-17 18:14:16 +00:00
path path/filepath: fix TestGlobError 2017-06-15 21:53:23 +00:00
plugin {net,os/user,plugin}: eliminate unnecessary C round-trips 2017-08-17 18:14:16 +00:00
reflect reflect: handle types with unexported methods before exported ones 2017-08-23 23:48:49 +00:00
regexp regexp: example for MatchString function 2017-07-15 21:13:35 +00:00
runtime runtime: only clear pointer-containing memory during map delete 2017-08-23 13:53:00 +00:00
sort sort: add example for Strings 2017-07-15 23:17:23 +00:00
strconv strconv: check bitsize range in ParseInt and ParseUint 2017-08-22 13:37:40 +00:00
strings strings: use slice instead of list and array in Fields comment 2017-08-14 21:25:53 +00:00
sync sync: delete a sentence from the Map docs 2017-07-21 22:00:47 +00:00
syscall syscall: skip some exec tests in container 2017-08-23 21:46:55 +00:00
testing all: fix easy-to-miss typos 2017-08-23 03:07:12 +00:00
text all: unindent some big chunks of code 2017-08-18 06:59:48 +00:00
time time: fix grammar/spelling errors in test comment 2017-08-21 17:52:45 +00:00
unicode unicode: move scripts from FoldCategories to FoldScripts 2017-06-15 01:05:31 +00:00
unsafe
vendor/golang_org/x
Make.dist
all.bash
all.bat
all.rc
androidtest.bash
bootstrap.bash
buildall.bash
clean.bash
clean.bat
clean.rc
cmp.bash
iostest.bash
make.bash
make.bat
make.rc
naclmake.bash
nacltest.bash
race.bash
race.bat
run.bash
run.bat
run.rc