本文整理汇总了Golang中github.com/ubuntu-core/snappy/snap.Info.Description方法的典型用法代码示例。如果您正苦于以下问题:Golang Info.Description方法的具体用法?Golang Info.Description怎么用?Golang Info.Description使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/ubuntu-core/snappy/snap.Info
的用法示例。
在下文中一共展示了Info.Description方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: mapSnap
// Map a localSnap information plus the given active flag to a
// map[string]interface{}, augmenting it with the given (purportedly remote)
// snap.
//
// It is a programming error (->panic) to call mapSnap with both arguments
// nil.
func mapSnap(localSnap *snap.Info, active bool, remoteSnap *snap.Info) map[string]interface{} {
var version, icon, name, developer, _type, description, summary string
var revision int
rollback := -1
update := -1
if localSnap == nil && remoteSnap == nil {
panic("no localSnaps & remoteSnap is nil -- how did i even get here")
}
status := "available"
installedSize := int64(-1)
downloadSize := int64(-1)
var prices map[string]float64
if remoteSnap != nil {
prices = remoteSnap.Prices
}
if localSnap != nil {
if active {
status = "active"
} else {
status = "installed"
}
}
var ref *snap.Info
if localSnap != nil {
ref = localSnap
} else {
ref = remoteSnap
}
name = ref.Name()
developer = ref.Developer
version = ref.Version
revision = ref.Revision
_type = string(ref.Type)
if localSnap != nil {
icon = snapIcon(localSnap)
summary = localSnap.Summary()
description = localSnap.Description()
installedSize = localSnap.Size
}
if remoteSnap != nil {
if icon == "" {
icon = remoteSnap.IconURL
}
if description == "" {
description = remoteSnap.Description()
}
if summary == "" {
summary = remoteSnap.Summary()
}
downloadSize = remoteSnap.Size
}
if localSnap != nil && active {
if remoteSnap != nil && revision != remoteSnap.Revision {
update = remoteSnap.Revision
}
// WARNING this'll only get the right* rollback if
// only two things can be installed
//
// *) not the actual right rollback because we aren't
// marking things failed etc etc etc)
//
//if len(localSnaps) == 2 {
// rollback = localSnaps[1^idx].Revision()
//}
}
result := map[string]interface{}{
"icon": icon,
"name": name,
"developer": developer,
"status": status,
"type": _type,
"vendor": "",
"revision": revision,
"version": version,
"description": description,
"summary": summary,
"installed-size": installedSize,
"download-size": downloadSize,
}
if len(prices) > 0 {
//.........这里部分代码省略.........