本文整理匯總了Golang中v/io/jiri/profiles.Target.DebugString方法的典型用法代碼示例。如果您正苦於以下問題:Golang Target.DebugString方法的具體用法?Golang Target.DebugString怎麽用?Golang Target.DebugString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類v/io/jiri/profiles.Target
的用法示例。
在下文中一共展示了Target.DebugString方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: ExampleProfileTarget
func ExampleProfileTarget() {
var target profiles.Target
flags := flag.NewFlagSet("test", flag.ContinueOnError)
profiles.RegisterTargetAndEnvFlags(flags, &target)
flags.Parse([]string{"--target=arm-linux", "--env=A=B,C=D", "--env=E=F"})
fmt.Println(target.String())
fmt.Println(target.DebugString())
// Output:
// [email protected]
// [email protected] dir: --env=A=B,C=D,E=F envvars:[]
}
示例2: ensureAction
// ensureAction ensures that the requested profile and target
// is installed/uninstalled, installing/uninstalling it if and only if necessary.
func ensureAction(jirix *jiri.X, pdb *profiles.DB, action profiles.Action, installer, profile string, root jiri.RelPath, target profiles.Target) error {
verb := ""
switch action {
case profiles.Install:
verb = "install"
case profiles.Uninstall:
verb = "uninstall"
default:
return fmt.Errorf("unrecognised action %v", action)
}
if jirix.Verbose() {
fmt.Fprintf(jirix.Stdout(), "%s %v %s\n", verb, action, target)
}
if t := pdb.LookupProfileTarget(installer, profile, target); t != nil {
if jirix.Verbose() {
fmt.Fprintf(jirix.Stdout(), "%v %v is already %sed as %v\n", profile, target, verb, t)
}
return nil
}
mgr := LookupManager(profiles.QualifiedProfileName(installer, profile))
if mgr == nil {
return fmt.Errorf("profile %v is not supported", profile)
}
version, err := mgr.VersionInfo().Select(target.Version())
if err != nil {
return err
}
target.SetVersion(version)
if jirix.Verbose() {
fmt.Fprintf(jirix.Stdout(), "%s %s %s\n", verb, profile, target.DebugString())
}
if action == profiles.Install {
return mgr.Install(jirix, pdb, root, target)
}
return mgr.Uninstall(jirix, pdb, root, target)
}