go/src/cmd/internal/archive/archive.go

type Data

type Archive

func (a *Archive) File() *os.File {}

type Entry

type EntryType

const EntryPkgDef

const EntryGoObj

const EntryNativeObj

const EntrySentinelNonObj

func (e *Entry) String() string {}

type GoObj

const entryHeader

const entryLen

const timeFormat

var archiveHeader

var archiveMagic

var goobjHeader

var errCorruptArchive

var errTruncatedArchive

var errCorruptObject

var errNotObject

type ErrGoObjOtherVersion

func (e ErrGoObjOtherVersion) Error() string {}

type objReader

func (r *objReader) init(f *os.File) {}

// error records that an error occurred.
// It returns only the first error, so that an error
// caused by an earlier error does not discard information
// about the earlier error.
func (r *objReader) error(err error) error {}

// peek returns the next n bytes without advancing the reader.
func (r *objReader) peek(n int) ([]byte, error) {}

// readByte reads and returns a byte from the input file.
// On I/O error or EOF, it records the error but returns byte 0.
// A sequence of 0 bytes will eventually terminate any
// parsing state in the object file. In particular, it ends the
// reading of a varint.
func (r *objReader) readByte() byte {}

// readFull reads exactly len(b) bytes from the input file.
// If an error occurs, read returns the error but also
// records it, so it is safe for callers to ignore the result
// as long as delaying the report is not a problem.
func (r *objReader) readFull(b []byte) error {}

// skip skips n bytes in the input.
func (r *objReader) skip(n int64) {}

// New writes to f to make a new archive.
func New(f *os.File) (*Archive, error) {}

// Parse parses an object file or archive from f.
func Parse(f *os.File, verbose bool) (*Archive, error) {}

// trimSpace removes trailing spaces from b and returns the corresponding string.
// This effectively parses the form used in archive headers.
func trimSpace(b []byte) string {}

// parseArchive parses a Unix archive of Go object files.
func (r *objReader) parseArchive(verbose bool) error {}

// parseObject parses a single Go object file.
// The object file consists of a textual header ending in "\n!\n"
// and then the part we want to parse begins.
// The format of that part is defined in a comment at the top
// of cmd/internal/goobj/objfile.go.
func (r *objReader) parseObject(o *GoObj, size int64) error {}

// AddEntry adds an entry to the end of a, with the content from r.
func (a *Archive) AddEntry(typ EntryType, name string, mtime int64, uid, gid int, mode os.FileMode, size int64, r io.Reader) {}

// exactly16Bytes truncates the string if necessary so it is at most 16 bytes long,
// then pads the result with spaces to be exactly 16 bytes.
// Fmt uses runes for its width calculation, but we need bytes in the entry header.
func exactly16Bytes(s string) string {}

const HeaderSize

func ReadHeader(b *bufio.Reader, name string) int {}

func FormatHeader(arhdr []byte, name string, size int64) {}