Documentation
¶
Index ¶
- Variables
- func EnvOr(key, def string) string
- func Getgoextlinkenabled() string
- func ModInfoData(info string) []byte
- type CacheRecord
- type CompiledPackages
- type File
- type FileSet
- type Module
- type ModuleError
- type Options
- func (opts *Options) AppendASMFlags(flags ...string) []string
- func (opts *Options) AppendEnviron(env []string) []string
- func (opts *Options) AppendGCFlags(flags []string) []string
- func (opts *Options) AppendLDFlags(flags ...string) []string
- func (opts *Options) GOARCH() string
- func (opts *Options) GOOS() string
- func (opts *Options) GetBuildTags() []string
- type Origin
- type Package
- type PackageError
- type PczStdTransformer
- type Platform
- func (p Platform) Arch() string
- func (p Platform) GO386() string
- func (p Platform) GOAMD64() string
- func (p Platform) GOARCH(envGOARCH string) string
- func (p Platform) GOARM() string
- func (p Platform) GOMIPS() string
- func (p Platform) GOMIPS64() string
- func (p Platform) GOOS(envGOOS string) string
- func (p Platform) GOPPC64() string
- func (p Platform) GOWASM() string
- func (p Platform) OS() string
- func (p Platform) Pair() (os, arch string)
- type Toolchain
- func (t *Toolchain) Build(pkgs []*Package, output string) (err error)
- func (tc *Toolchain) CreateCacheRecord(now time.Time, buildDir string, p *Package) (_ *CacheRecord, err error)
- func (t *Toolchain) GoVersion() string
- func (t *Toolchain) Link(p *Package, deps *CompiledPackages, output string) (err error)
- func (t *Toolchain) List(dir string) (pkgs []*Package, err error)
- func (t *Toolchain) Pack(archiveFile string, objFiles ...string) (newArchiveFile string, err error)
- func (t *Toolchain) Symabis(p *Package) (outputfile string, err error)
- func (tc *Toolchain) VerifyVersion(gover string) error
- type Transformer
Constants ¶
This section is empty.
Variables ¶
var ( GO386 = EnvOr("GO386", defaultGO386) GOAMD64 = EnvOr("GOAMD64", defaultGOAMD64) GOARM = EnvOr("GOARM", "7") GOMIPS = EnvOr("GOMIPS", defaultGOMIPS) GOMIPS64 = EnvOr("GOMIPS64", defaultGOMIPS64) GOPPC64 = EnvOr("GOPPC64", defaultGOPPC64) GOWASM = EnvOr("GOWASM", "") GO_LDSO = defaultGO_LDSO GOTOOLDIR = EnvOr("GOTOOLDIR", build.ToolDir) Context = build.Default GoDefaultIncludeDir = filepath.Join(Context.GOROOT, "pkg", "include") )
Functions ¶
func Getgoextlinkenabled ¶
func Getgoextlinkenabled() string
func ModInfoData ¶
Types ¶
type CacheRecord ¶
type CacheRecord struct {
Tags []string `yaml:"tags"`
Src FileSet `yaml:"src"`
Build FileSet `yaml:"build"`
}
func (*CacheRecord) SourceUnchanged ¶
func (old *CacheRecord) SourceUnchanged(newc *CacheRecord) bool
type CompiledPackages ¶
type CompiledPackages struct {
// contains filtered or unexported fields
}
func NewCompiledPackages ¶
func NewCompiledPackages() *CompiledPackages
func (*CompiledPackages) Add ¶
func (cp *CompiledPackages) Add(importpath, actualImportpath, ar string)
Add a built archive (.a file) for the importpath.
func (*CompiledPackages) Importcfg ¶
func (cp *CompiledPackages) Importcfg() []byte
type File ¶
type File struct {
Name string `yaml:"name"`
// SHA256Hex
SHA256Hex string `yaml:"sha256"`
ModTime int64 `yaml:"mtime"`
}
func (*File) VerifyUnchanged ¶
type FileSet ¶
type FileSet struct {
Dir string `yaml:"dir"`
Files []*File `yaml:"files"`
// contains filtered or unexported fields
}
type Module ¶
type Module struct {
Path string `json:",omitempty"` // module path
Version string `json:",omitempty"` // module version
Query string `json:",omitempty"` // version query corresponding to this version
Versions []string `json:",omitempty"` // available module versions
Replace *Module `json:",omitempty"` // replaced by this module
Time *time.Time `json:",omitempty"` // time version was created
Update *Module `json:",omitempty"` // available update (with -u)
Main bool `json:",omitempty"` // is this the main module?
Indirect bool `json:",omitempty"` // module is only indirectly needed by main module
Dir string `json:",omitempty"` // directory holding local copy of files, if any
GoMod string `json:",omitempty"` // path to go.mod file describing module, if any
GoVersion string `json:",omitempty"` // go version used in module
Retracted []string `json:",omitempty"` // retraction information, if any (with -retracted or -u)
Deprecated string `json:",omitempty"` // deprecation message, if any (with -u)
Error *ModuleError `json:",omitempty"` // error loading module
Origin *Origin `json:",omitempty"` // provenance of module
Reuse bool `json:",omitempty"` // reuse of old module info is safe
}
Module
copied from src/cmd/go/internal/modinfo/info.go#ModulePublic
type ModuleError ¶
type ModuleError struct {
Err string // error text
}
type Options ¶
type Options struct {
Context *build.Context
Debug bool `cli:"debug,#debug build process"`
BuildDir string `cli:"build-dir,def=.pcz/build,#set directory to store intermediate build outputs"`
Mode string // `cli:"mode,#the same as go build -buildmode"`
EnableMSan bool // `cli:"msan,#enable memory san interface"`
EnableASan bool // `cli:"asan,#enable address san interface"`
EnableRace bool // `cli:"race,#enable race detector"`
NoCache bool `cli:"no-cache,#build without cache"`
Trimpath bool `cli:"trimpath,#remove all filesystem paths from the resulting executable"`
Defs []string `cli:"X|define,#link-time string value definition of the form importpath.name=value"`
EntrySymbol string `cli:"entry,def=rt0,#set entry symbol name"`
Platform Platform `cli:"p|platform,#\"os/arch\" pair"`
Tags []string `cli:"t|tag,#add build tags"`
LDFlags []string `cli:"L|ldflag,#add flags to go tool link"`
GCFlags []string `cli:"G|gcflag,#add flags to go tool compile (not including gccgo)"`
ASMFlags []string `cli:"A|asmflag,#add flags to go tool asm"`
}
func (*Options) AppendASMFlags ¶
func (*Options) AppendEnviron ¶
func (*Options) AppendGCFlags ¶
func (*Options) AppendLDFlags ¶
func (*Options) GOARCH ¶
GOARCH returns a valid GOARCH value suggested by the .Platform or GOARCH environment variable.
func (*Options) GOOS ¶
GOOS returns a valid GOOS value suggested by the .Platform or GOOS environment variable.
func (*Options) GetBuildTags ¶
type Origin ¶
type Origin struct {
VCS string `json:",omitempty"` // "git" etc
URL string `json:",omitempty"` // URL of repository
Subdir string `json:",omitempty"` // subdirectory in repo
// If TagSum is non-empty, then the resolution of this module version
// depends on the set of tags present in the repo, specifically the tags
// of the form TagPrefix + a valid semver version.
// If the matching repo tags and their commit hashes still hash to TagSum,
// the Origin is still valid (at least as far as the tags are concerned).
// The exact checksum is up to the Repo implementation; see (*gitRepo).Tags.
TagPrefix string `json:",omitempty"`
TagSum string `json:",omitempty"`
// If Ref is non-empty, then the resolution of this module version
// depends on Ref resolving to the revision identified by Hash.
// If Ref still resolves to Hash, the Origin is still valid (at least as far as Ref is concerned).
// For Git, the Ref is a full ref like "refs/heads/main" or "refs/tags/v1.2.3",
// and the Hash is the Git object hash the ref maps to.
// Other VCS might choose differently, but the idea is that Ref is the name
// with a mutable meaning while Hash is a name with an immutable meaning.
Ref string `json:",omitempty"`
Hash string `json:",omitempty"`
// If RepoSum is non-empty, then the resolution of this module version
// failed due to the repo being available but the version not being present.
// This depends on the entire state of the repo, which RepoSum summarizes.
// For Git, this is a hash of all the refs and their hashes.
RepoSum string `json:",omitempty"`
}
An Origin describes the provenance of a given repo method result. It can be passed to CheckReuse (usually in a different go command invocation) to see whether the result remains up-to-date.
copied from src/cmd/go/internal/modfetch/codehost/codehost.go#Origin
type Package ¶
type Package struct {
// Note: These fields are part of the go command's public API.
// See list.go. It is okay to add fields, but not to change or
// remove existing ones. Keep in sync with ../list/list.go
Dir string `json:",omitempty"` // directory containing package sources
ImportPath string `json:",omitempty"` // import path of package in dir
ImportComment string `json:",omitempty"` // path in import comment on package statement
Name string `json:",omitempty"` // package name
Doc string `json:",omitempty"` // package documentation string
Target string `json:",omitempty"` // installed target for this package (may be executable)
Shlib string `json:",omitempty"` // the shared library that contains this package (only set when -linkshared)
Root string `json:",omitempty"` // Go root, Go path dir, or module root dir containing this package
ConflictDir string `json:",omitempty"` // Dir is hidden by this other directory
ForTest string `json:",omitempty"` // package is only for use in named test
Export string `json:",omitempty"` // file containing export data (set by go list -export)
BuildID string `json:",omitempty"` // build ID of the compiled package (set by go list -export)
Module *Module `json:",omitempty"` // info about package's module, if any
Match []string `json:",omitempty"` // command-line patterns matching this package
Goroot bool `json:",omitempty"` // is this package found in the Go root?
Standard bool `json:",omitempty"` // is this package part of the standard Go library?
DepOnly bool `json:",omitempty"` // package is only as a dependency, not explicitly listed
BinaryOnly bool `json:",omitempty"` // package cannot be recompiled
Incomplete bool `json:",omitempty"` // was there an error loading this package or dependencies?
DefaultGODEBUG string `json:",omitempty"` // default GODEBUG setting (only for Name=="main")
// Stale and StaleReason remain here *only* for the list command.
// They are only initialized in preparation for list execution.
// The regular build determines staleness on the fly during action execution.
Stale bool `json:",omitempty"` // would 'go install' do anything for this package?
StaleReason string `json:",omitempty"` // why is Stale true?
// Source files
// If you add to this list you MUST add to p.AllFiles (below) too.
// Otherwise file name security lists will not apply to any new additions.
GoFiles []string `json:",omitempty"` // .go source files (excluding CgoFiles, TestGoFiles, XTestGoFiles)
CgoFiles []string `json:",omitempty"` // .go source files that import "C"
CompiledGoFiles []string `json:",omitempty"` // .go output from running cgo on CgoFiles
IgnoredGoFiles []string `json:",omitempty"` // .go source files ignored due to build constraints
InvalidGoFiles []string `json:",omitempty"` // .go source files with detected problems (parse error, wrong package name, and so on)
IgnoredOtherFiles []string `json:",omitempty"` // non-.go source files ignored due to build constraints
CFiles []string `json:",omitempty"` // .c source files
CXXFiles []string `json:",omitempty"` // .cc, .cpp and .cxx source files
MFiles []string `json:",omitempty"` // .m source files
HFiles []string `json:",omitempty"` // .h, .hh, .hpp and .hxx source files
FFiles []string `json:",omitempty"` // .f, .F, .for and .f90 Fortran source files
SFiles []string `json:",omitempty"` // .s source files
SwigFiles []string `json:",omitempty"` // .swig files
SwigCXXFiles []string `json:",omitempty"` // .swigcxx files
SysoFiles []string `json:",omitempty"` // .syso system object files added to package
// Embedded files
EmbedPatterns []string `json:",omitempty"` // //go:embed patterns
EmbedFiles []string `json:",omitempty"` // files matched by EmbedPatterns
// Cgo directives
CgoCFLAGS []string `json:",omitempty"` // cgo: flags for C compiler
CgoCPPFLAGS []string `json:",omitempty"` // cgo: flags for C preprocessor
CgoCXXFLAGS []string `json:",omitempty"` // cgo: flags for C++ compiler
CgoFFLAGS []string `json:",omitempty"` // cgo: flags for Fortran compiler
CgoLDFLAGS []string `json:",omitempty"` // cgo: flags for linker
CgoPkgConfig []string `json:",omitempty"` // cgo: pkg-config names
// Dependency information
Imports []string `json:",omitempty"` // import paths used by this package
ImportMap map[string]string `json:",omitempty"` // map from source import to ImportPath (identity entries omitted)
Deps []string `json:",omitempty"` // all (recursively) imported dependencies
// Error information
// Incomplete is above, packed into the other bools
Error *PackageError `json:",omitempty"` // error loading this package (not dependencies)
DepsErrors []*PackageError `json:",omitempty"` // errors loading dependencies, collected by go list before output
// Test information
// If you add to this list you MUST add to p.AllFiles (below) too.
// Otherwise file name security lists will not apply to any new additions.
TestGoFiles []string `json:",omitempty"` // _test.go files in package
TestImports []string `json:",omitempty"` // imports from TestGoFiles
TestEmbedPatterns []string `json:",omitempty"` // //go:embed patterns
TestEmbedFiles []string `json:",omitempty"` // files matched by TestEmbedPatterns
XTestGoFiles []string `json:",omitempty"` // _test.go files outside package
XTestImports []string `json:",omitempty"` // imports from XTestGoFiles
XTestEmbedPatterns []string `json:",omitempty"` // //go:embed patterns
XTestEmbedFiles []string `json:",omitempty"` // files matched by XTestEmbedPatterns
}
Package
copied from src/cmd/go/internal/load/pkg.go#PackagePublic
type PackageError ¶
type PackageError struct {
ImportStack []string // shortest path from package named on command line to this one
Pos string // position of error
Err error // the error itself
IsImportCycle bool // the error is an import cycle
Hard bool // whether the error is soft or hard; soft errors are ignored in some places
// contains filtered or unexported fields
}
A PackageError describes an error loading information about a package.
type PczStdTransformer ¶
type PczStdTransformer struct{}
type Toolchain ¶
type Toolchain struct {
// contains filtered or unexported fields
}
func NewToolchain ¶
func (*Toolchain) CreateCacheRecord ¶
func (*Toolchain) Link ¶
func (t *Toolchain) Link(p *Package, deps *CompiledPackages, output string) (err error)
func (*Toolchain) VerifyVersion ¶
VerifyVersion returns error if gover is different from versions reported by compile/asm/link.