Documentation
¶
Index ¶
Constants ¶
View Source
const ( // GitCmd 获取最近一次git commit id函数 GitCmd = `git rev-parse HEAD` //git log --pretty=format:"%H" -1 // DefaultGitCommitExpr 默认git commit变量表达式 DefaultGitCommitExpr = "{{.GitCommit}}" )
View Source
const (
// DefaultDateExpr 默认日期变量表达式
DefaultDateExpr = "{{.Date}}"
)
Variables ¶
View Source
var ( // ErrExprEmpty 表达式为空错误 ErrExprEmpty = errors.New("express is empty") // ErrExpr 非法表达式 ErrExpr = errors.New("invalid express") // ErrCmdEmpty 命令为空错误 ErrCmdEmpty = errors.New("command is empty") // ErrCmd 非法命令 ErrCmd = errors.New("invalid command") )
View Source
var ( // DefaultDateVar 默认的日期变量实例 DefaultDateVar = NewDateVar(time.RFC3339, DefaultDateExpr) )
View Source
var (
// DefaultGitCommitVar 默认git commit变量
DefaultGitCommitVar, _ = NewGitCommitVar(GitCmd, DefaultGitCommitExpr)
)
Functions ¶
Types ¶
type CmdVar ¶ added in v0.6.1
type CmdVar struct {
}
CmdVar 命令变量
type DateVar ¶
type DateVar struct {
// contains filtered or unexported fields
}
DateVar 日期变量
type GitCommitVar ¶
type GitCommitVar struct {
// contains filtered or unexported fields
}
GitCommitVar git commit变量
func NewGitCommitVar ¶
func NewGitCommitVar(cmd, expr string) (v *GitCommitVar, err error)
NewGitCommitVar 实例化git commit变量
func (*GitCommitVar) Eval ¶
func (v *GitCommitVar) Eval(_ string, debug bool) (val string, err error)
Eval 表达式变量求值
func (*GitCommitVar) Match ¶
func (v *GitCommitVar) Match(expr string) (matched bool)
Match 表达式是否可以使用当前变量求值
Click to show internal directories.
Click to hide internal directories.