本文整理匯總了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
}