本文整理汇总了Golang中github.com/eris-ltd/eris-cli/definitions.Contracts.Name方法的典型用法代码示例。如果您正苦于以下问题:Golang Contracts.Name方法的具体用法?Golang Contracts.Name怎么用?Golang Contracts.Name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/eris-ltd/eris-cli/definitions.Contracts
的用法示例。
在下文中一共展示了Contracts.Name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: checkAppAndChain
func checkAppAndChain(app *definitions.Contracts, name string) error {
var chain string
// name is pulled in from the do struct. need to work with both
// it (as an override) and the app.ChainName
switch name {
case "":
if app.ChainName == "" {
return nil
} else {
chain = app.ChainName
}
case "t", "tmp", "temp":
return nil
default:
chain = name
}
if strings.Contains(app.Name, " ") {
app.Name = strings.Replace(app.Name, " ", "_", -1)
}
// this is hacky.... at best.
if len(app.AppType.ChainTypes) == 1 && app.AppType.ChainTypes[0] == "eth" {
if r := regexp.MustCompile("eth"); r.MatchString(chain) {
return nil
} else {
return fmt.Errorf("The marmots detected a disturbance in the force.\n\nYou asked them to run the App Type: (%s).\nBut the chainName (%s) doesn't contain the name (%s).\nPlease rename the chain or service to contain the name (%s)", app.AppType.Name, chain, "eth", "eth")
}
}
return nil
}