architecture-independent object file output
const HeaderSize = 60
func FormatHeader(arhdr []byte, name string, size int64)
func ReadHeader(b *bufio.Reader, name string) int
type Archive struct {
Entries []Entry
// contains filtered or unexported fields
}
func New(f *os.File) (*Archive, error)
New writes to f to make a new archive.
func Parse(f *os.File, verbose bool) (*Archive, error)
Parse parses an object file or archive from f.
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 (a *Archive) File() *os.File
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 Data struct {
Offset int64
Size int64
}
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 (e *Entry) String() string
type EntryType int
const (
EntryPkgDef EntryType = iota
EntryGoObj
EntryNativeObj
EntrySentinelNonObj
)
type ErrGoObjOtherVersion struct {
// contains filtered or unexported fields
}
func (e ErrGoObjOtherVersion) Error() string
type GoObj struct {
TextHeader []byte
Arch string
Data
}