本文整理匯總了Golang中github.com/eris-ltd/eris-cli/definitions.Do.Destination方法的典型用法代碼示例。如果您正苦於以下問題:Golang Do.Destination方法的具體用法?Golang Do.Destination怎麽用?Golang Do.Destination使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/eris-ltd/eris-cli/definitions.Do
的用法示例。
在下文中一共展示了Do.Destination方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: ImportKey
func ImportKey(do *definitions.Do) error {
do.Name = "keys"
do.Operations.ContainerNumber = 1
if err := srv.EnsureRunning(do); err != nil {
return err
}
do.Operations.Interactive = false
dir := path.Join(ErisContainerRoot, "keys", "data", do.Address)
do.Operations.Args = []string{"mkdir", dir} //need to mkdir for import
if err := srv.ExecService(do); err != nil {
return err
}
//src on host
if do.Source == "" {
do.Source = filepath.Join(KeysPath, "data", do.Address, do.Address)
}
//dest in container
do.Destination = dir
if err := data.ImportData(do); err != nil {
return err
}
return nil
}
示例2: checkErisContainerRoot
// check path for ErisContainerRoot
// XXX this is opiniated & we may want to change in future
// for more flexibility with filesystem of data conts
func checkErisContainerRoot(do *definitions.Do, typ string) error {
r, err := regexp.Compile(ErisContainerRoot)
if err != nil {
return err
}
switch typ {
case "import":
if r.MatchString(do.Destination) != true { //if not there join it
do.Destination = path.Join(ErisContainerRoot, do.Destination)
return nil
} else { // matches: do nothing
return nil
}
case "export":
if r.MatchString(do.Source) != true {
do.Source = path.Join(ErisContainerRoot, do.Source)
return nil
} else {
return nil
}
}
return nil
}
示例3: ExportKey
func ExportKey(do *definitions.Do) error {
do.Name = "keys"
do.Operations.ContainerNumber = 1
if err := srv.EnsureRunning(do); err != nil {
return err
}
//destination on host
if do.Destination == "" {
do.Destination = filepath.Join(KeysPath, "data")
}
//src in container
do.Source = path.Join(ErisContainerRoot, "keys", "data", do.Address)
if err := data.ExportData(do); err != nil {
return err
}
return nil
}