1
0
mirror of https://github.com/golang/go synced 2024-11-20 02:14:46 -07:00

archive/tar: minor doc fixes

Use "file" consistently instead of "entry".

Change-Id: Ia81c9665d0d956adb78f7fa49de40cdb87fba000
Reviewed-on: https://go-review.googlesource.com/60150
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Joe Tsai 2017-08-26 02:12:56 -07:00 committed by Joe Tsai
parent f85dc050ba
commit c1679286c3
3 changed files with 9 additions and 10 deletions

View File

@ -56,7 +56,7 @@ func (he headerError) Error() string {
const ( const (
// Type '0' indicates a regular file. // Type '0' indicates a regular file.
TypeReg = '0' TypeReg = '0'
TypeRegA = '\x00' // For legacy support (use TypeReg instead) TypeRegA = '\x00' // For legacy support; use TypeReg instead
// Type '1' to '6' are header-only flags and may not have a data body. // Type '1' to '6' are header-only flags and may not have a data body.
TypeLink = '1' // Hard link TypeLink = '1' // Hard link
@ -85,7 +85,7 @@ const (
TypeGNUSparse = 'S' TypeGNUSparse = 'S'
// Types 'L' and 'K' are used by the GNU format for a meta file // Types 'L' and 'K' are used by the GNU format for a meta file
// used to store the path or link name for the next entry. // used to store the path or link name for the next file.
// This package transparently handles these types. // This package transparently handles these types.
TypeGNULongName = 'L' TypeGNULongName = 'L'
TypeGNULongLink = 'K' TypeGNULongLink = 'K'
@ -166,13 +166,12 @@ type Header struct {
// //
// A file is sparse if len(SparseHoles) > 0 or Typeflag is TypeGNUSparse. // A file is sparse if len(SparseHoles) > 0 or Typeflag is TypeGNUSparse.
// If TypeGNUSparse is set, then the format is GNU, otherwise // If TypeGNUSparse is set, then the format is GNU, otherwise
// the PAX format with GNU-specific record is used. // the format is PAX (by using GNU-specific PAX records).
// //
// A sparse file consists of fragments of data, intermixed with holes // A sparse file consists of fragments of data, intermixed with holes
// (described by this field). A hole is semantically a block of NUL-bytes, // (described by this field). A hole is semantically a block of NUL-bytes,
// but does not actually exist within the tar file. // but does not actually exist within the tar file.
// The logical size of the file stored in the Size field, while // The holes must be sorted in ascending order,
// the holes must be sorted in ascending order,
// not overlap with each other, and not extend past the specified Size. // not overlap with each other, and not extend past the specified Size.
SparseHoles []SparseEntry SparseHoles []SparseEntry

View File

@ -604,11 +604,11 @@ func readGNUSparseMap0x1(paxHdrs map[string]string) (sparseDatas, error) {
return spd, nil return spd, nil
} }
// Read reads from the current entry in the tar archive. // Read reads from the current file in the tar archive.
// It returns (0, io.EOF) when it reaches the end of that entry, // It returns (0, io.EOF) when it reaches the end of that file,
// until Next is called to advance to the next entry. // until Next is called to advance to the next file.
// //
// If the current file is sparse, then the regions marked as a sparse hole // If the current file is sparse, then the regions marked as a hole
// are read back as NUL-bytes. // are read back as NUL-bytes.
// //
// Calling Read on special types like TypeLink, TypeSymLink, TypeChar, // Calling Read on special types like TypeLink, TypeSymLink, TypeChar,

View File

@ -389,7 +389,7 @@ func splitUSTARPath(name string) (prefix, suffix string, ok bool) {
// Write returns the error ErrWriteTooLong if more than // Write returns the error ErrWriteTooLong if more than
// Header.Size bytes are written after WriteHeader. // Header.Size bytes are written after WriteHeader.
// //
// If the current file is sparse, then the regions marked as a sparse hole // If the current file is sparse, then the regions marked as a hole
// must be written as NUL-bytes. // must be written as NUL-bytes.
// //
// Calling Write on special types like TypeLink, TypeSymLink, TypeChar, // Calling Write on special types like TypeLink, TypeSymLink, TypeChar,