archive

package standard library
go1.16 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 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

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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 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