本文整理汇总了Golang中github.com/maruel/pre-commit-go/scm.ReadOnlyRepo.Eval方法的典型用法代码示例。如果您正苦于以下问题:Golang ReadOnlyRepo.Eval方法的具体用法?Golang ReadOnlyRepo.Eval怎么用?Golang ReadOnlyRepo.Eval使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/maruel/pre-commit-go/scm.ReadOnlyRepo
的用法示例。
在下文中一共展示了ReadOnlyRepo.Eval方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: cmdRun
// cmdRun runs all the enabled checks.
func (a *application) cmdRun(repo scm.ReadOnlyRepo, modes []checks.Mode, against string, prereqReady *sync.WaitGroup) error {
var err error
var old scm.Commit
if against != "" {
if old = repo.Eval(against); old == scm.Invalid {
return errors.New("invalid commit 'against'")
}
} else {
if old = repo.Eval(string(scm.Upstream)); old == scm.Invalid {
return errors.New("no upstream")
}
}
change, err := repo.Between(scm.Current, old, a.config.IgnorePatterns)
if err != nil {
return err
}
return a.runChecks(change, modes, prereqReady)
}
示例2: cmdRun
// cmdRun runs all the enabled checks.
func cmdRun(repo scm.ReadOnlyRepo, config *checks.Config, modes []checks.Mode, against string, prereqReady *sync.WaitGroup) error {
var err error
var old scm.Commit
if against != "" {
if old, err = repo.Eval(against); err != nil {
return err
}
} else {
if old, err = repo.Upstream(); err != nil {
return err
}
}
change, err := repo.Between(scm.Current, old, config.IgnorePatterns)
if err != nil {
return err
}
return runChecks(config, change, modes, prereqReady)
}