Documentation ¶
Index ¶
- Variables
- type Build
- type Builder
- type Config
- type Context
- type Details
- type Env
- type Error
- type ExpectedSingleEnvErr
- type Fields
- type FlagArray
- type Git
- type IgnoreCheck
- type Options
- type PackCompleted
- type PackFile
- type PackOut
- type Package
- type Runtime
- type Semver
- type StringArray
- type Template
- func (t *Template) Apply(s string) (string, error)
- func (t *Template) ApplyAll(sps ...*string) error
- func (t *Template) ApplySingleEnvOnly(s string) (string, error)
- func (t *Template) Bool(s string) (bool, error)
- func (t *Template) WithBuildOptions(opts Options) *Template
- func (t *Template) WithEnv(e map[string]string) *Template
- func (t *Template) WithEnvS(envs []string) *Template
- func (t *Template) WithExtraFields(f Fields) *Template
- type UpdateFile
Constants ¶
This section is empty.
Variables ¶
var Default = &Builder{}
Default builder instance.
Functions ¶
This section is empty.
Types ¶
type Build ¶
type Build struct { ID string `yaml:"id,omitempty" json:"id,omitempty"` Goos []string `yaml:"goos,omitempty" json:"goos,omitempty"` Goarch []string `yaml:"goarch,omitempty" json:"goarch,omitempty"` Goarm []string `yaml:"goarm,omitempty" json:"goarm,omitempty"` Gomips []string `yaml:"gomips,omitempty" json:"gomips,omitempty"` Goamd64 []string `yaml:"goamd64,omitempty" json:"goamd64,omitempty"` ModulePath string `yaml:"module_path" json:"module_path"` ProductId string `yaml:"product_id" json:"product_id"` ProjectName string `yaml:"project_name" json:"project_name"` Target string `yaml:"target,omitempty" json:"target,omitempty"` Dir string `yaml:"dir,omitempty" json:"dir,omitempty"` Main string `yaml:"main,omitempty" json:"main,omitempty"` GoBinary string `yaml:"go_binary,omitempty" json:"go_binary,omitempty"` Command string `yaml:"command,omitempty" json:"command,omitempty"` Package Package `yaml:"package" json:"package"` Details `yaml:",inline" json:",inline"` // nolint: tagliatelle }
Build contains the build configuration section.
type Builder ¶
type Builder struct{}
Builder is golang builder.
type Context ¶
type Context struct { stdctx.Context Config Config Env Env Git Git Date time.Time Snapshot bool Semver Semver Runtime Runtime }
Context carries along some data through the pipes.
func NewWithTimeout ¶
NewWithTimeout new context with the given timeout.
type Details ¶
type Details struct { Buildmode string `yaml:"buildmode,omitempty" json:"buildmode,omitempty"` Ldflags StringArray `yaml:"ldflags,omitempty" json:"ldflags,omitempty"` Tags FlagArray `yaml:"tags,omitempty" json:"tags,omitempty"` Flags FlagArray `yaml:"flags,omitempty" json:"flags,omitempty"` AsmFlags StringArray `yaml:"asm_flags,omitempty" json:"asm_flags,omitempty"` GcFlags StringArray `yaml:"gc_flags,omitempty" json:"gc_flags,omitempty"` Env []string `yaml:"env,omitempty" json:"env,omitempty"` }
type Env ¶
Env is the environment variables.
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error is returned on any template error.
type ExpectedSingleEnvErr ¶
type ExpectedSingleEnvErr struct{}
func (ExpectedSingleEnvErr) Error ¶
func (e ExpectedSingleEnvErr) Error() string
type Fields ¶
type Fields map[string]interface{}
Fields that will be available to the template engine.
type Git ¶
type Git struct { Branch string CurrentTag string PreviousTag string Commit string ShortCommit string FullCommit string FirstCommit string CommitDate time.Time URL string Summary string TagSubject string TagContents string TagBody string Dirty bool }
Git includes tags and diffs used in some point.
type IgnoreCheck ¶ added in v1.8.76
type PackCompleted ¶ added in v1.8.76
type Package ¶
type Package struct { Os string `yaml:"os" json:"os"` ProductCode string `yaml:"product_code" json:"product_code"` Model string `yaml:"model" json:"model"` //prod, test, dev Format string `yaml:"format" json:"format"` //zip, tar.gz, tgz, tar, cab(windows), setup Dist string `yaml:"dist" json:"dist"` //输出目录 OutFile string `yaml:"out_file" json:"out_file"` //输出文件名,可以为空 HashFile string `yaml:"hash_file" json:"hash_file"` //输出pack 总的包描述文件,如: updates.json BaseUrl string `yaml:"base_url" json:"base_url"` Ignore []string `yaml:"ignore" json:"ignore"` ModelIf int `yaml:"model_if" json:"model_if"` //输出文件名,带model信息 OsIf int `yaml:"os_if" json:"os_if"` //输出文件名,带os信息 Version int `yaml:"version" json:"version"` //0:输出文件名后+“-版本号”,1:不需要版本号; 2 压缩文件前带版本号 Hash int `yaml:"hash" json:"hash"` //0 不输出, 1 输出所有原文件 md5 hash描述文件 // contains filtered or unexported fields }
func (*Package) WithCompleted ¶ added in v1.8.99
func (p *Package) WithCompleted(check PackCompleted)
func (*Package) WithIgnoreCheck ¶ added in v1.8.99
func (p *Package) WithIgnoreCheck(check IgnoreCheck)
type Template ¶
type Template struct {
// contains filtered or unexported fields
}
Template holds data that can be applied to a template string.
func (*Template) ApplyAll ¶
ApplyAll applies all the given strings against the Fields stored in the template. Application stops as soon as an error is encountered.
func (*Template) ApplySingleEnvOnly ¶
ApplySingleEnvOnly enforces template to only contain a single environment variable and nothing else.
func (*Template) WithBuildOptions ¶
func (*Template) WithEnvS ¶
WithEnvS overrides template's env field with the given KEY=VALUE list of environment variables.
func (*Template) WithExtraFields ¶
WithExtraFields allows to add new more custom fields to the template. It will override fields with the same name.