archive

package standard library
go1.17.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 9, 2021 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Overview

Package archive implements reading of archive files generated by the Go toolchain.

Index

Constants

View Source
const HeaderSize = 60

architecture-independent object file output

Variables

This section is empty.

Functions

func FormatHeader added in go1.17

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

func ReadHeader added in go1.17

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

Types

type Archive

type Archive struct {
	Entries []Entry
	// contains filtered or unexported fields
}

func New

func New(f *os.File) (*Archive, error)

New writes to f to make a new archive.

func Parse

func Parse(f *os.File, verbose bool) (*Archive, error)

Parse parses an object file or archive from f.

func (*Archive) AddEntry

func (a *Archive) AddEntry(typ EntryType, name string, mtime int64, uid, gid int, mode os.FileMode, size int64, r io.Reader)

AddEntry adds an entry to the end of a, with the content from r.

func (*Archive) File

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

type Data

type Data struct {
	Offset int64
	Size   int64
}

A Data is a reference to data stored in an object file. It records the offset and size of the data, so that a client can read the data only if necessary.

type Entry

type Entry struct {
	Name  string
	Type  EntryType
	Mtime int64
	Uid   int
	Gid   int
	Mode  os.FileMode
	Data
	Obj *GoObj // nil if this entry is not a Go object file
}

func (*Entry) String

func (e *Entry) String() string

type EntryType

type EntryType int
const (
	EntryPkgDef EntryType = iota
	EntryGoObj
	EntryNativeObj
)

type ErrGoObjOtherVersion added in go1.17

type ErrGoObjOtherVersion struct {
	// contains filtered or unexported fields
}

func (ErrGoObjOtherVersion) Error added in go1.17

func (e ErrGoObjOtherVersion) Error() string

type GoObj

type GoObj struct {
	TextHeader []byte
	Arch       string
	Data
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL