Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type BuildState ¶
type BuildState int
const ( Setup BuildState = iota // pre-running state. jobs can still be enqueued and config can be changed Running // the Builder is running. No new jobs can be queued Stopped // the builder was stopped without any errors Err // the builder encountered and error )
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
The Builder struct manages the entire multi-goroutine build process. It starts the worker routines, distributes the BuildJobs, and gathers the BuildResults and BuildErrors.
func NewBuilder ¶
Generate a new Builder struct with a configuration.
func (*Builder) AddJob ¶
Add a new job to the build queue, as long as the builder is till in the Setup state.
func (*Builder) Errors ¶
Retrieve the BuildResults from the finished builder. If the builder is in an invalid state, return error.
func (*Builder) Results ¶
Retrieve the BuildResults from the finished builder. If the builder is in an invalid state, return error.
type Error ¶
type Error struct {
Job Job // copy of the original build job
Err string // error message encountered during build
}
When the build of a command fails, a Error is emitted.
type Job ¶
type Job struct {
GoPkgPath string // the path to the go package that is build
Compiler string // compiler used to build the pkg, probably go or tinygo. TODO: refactor to enum
Command string // complete build command issues by builder
// contains filtered or unexported fields
}
Job defines a job that can be scheduled by the Builder and executed by the work function. It has all necessary information to execute the build and gather error logs.
type Result ¶
type Result struct {
Job Job // copy of the original build job
BuildTime time.Duration // time it took to build the pkg
BinarySize uint64 // size of the binary in bytes
}
Build result captures information about the build that later can be used for statistics that can be gathered after the build. BuildResults are always valid and do not contain any error information. If errors are encountered during the build process, a BuildError is returned.