本文整理汇总了Golang中github.com/coreos/rkt/Godeps/_workspace/src/github.com/appc/spec/schema/lastditch.ImageManifest.UnmarshalJSON方法的典型用法代码示例。如果您正苦于以下问题:Golang ImageManifest.UnmarshalJSON方法的具体用法?Golang ImageManifest.UnmarshalJSON怎么用?Golang ImageManifest.UnmarshalJSON使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/coreos/rkt/Godeps/_workspace/src/github.com/appc/spec/schema/lastditch.ImageManifest
的用法示例。
在下文中一共展示了ImageManifest.UnmarshalJSON方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: newImgListLoadError
func newImgListLoadError(err error, imj []byte, blobKey string) error {
var lines []string
im := lastditch.ImageManifest{}
imErr := im.UnmarshalJSON(imj)
if imErr == nil {
lines = append(lines, fmt.Sprintf("Unable to load manifest of image %s (spec version %s) because it is invalid:", im.Name, im.ACVersion))
lines = append(lines, fmt.Sprintf(" %v", err))
} else {
lines = append(lines, "Unable to load manifest of an image because it is invalid:")
lines = append(lines, fmt.Sprintf(" %v", err))
lines = append(lines, " Also, failed to get any information about invalid image manifest:")
lines = append(lines, fmt.Sprintf(" %v", imErr))
}
lines = append(lines, "ID of the invalid image:")
lines = append(lines, fmt.Sprintf(" %s", blobKey))
return fmt.Errorf("%s", strings.Join(lines, "\n"))
}
示例2: newPodListImageLoadFailure
func newPodListImageLoadFailure(p *pod, err error, pm *schema.PodManifest, imj []byte, app schema.RuntimeApp) error {
im := lastditch.ImageManifest{}
imErr := im.UnmarshalJSON(imj)
acVersion := "unknown"
if imErr == nil {
acVersion = im.ACVersion
}
lines := []string{
fmt.Sprintf("Unable to load image %s manifest (spec version %s) because it is invalid:", app.Image.ID.String(), acVersion),
fmt.Sprintf(" %v", err),
}
if imErr != nil {
lines = append(lines, " Also, failed to get any information about invalid image manifest:")
lines = append(lines, fmt.Sprintf(" %v", imErr))
}
lines = append(lines, "Objects related to this error:")
lines = append(lines, fmt.Sprintf(" App: %q from failing image %q (%s)",
app.Name, app.Image.Name, app.Image.ID))
lines = append(lines, fmt.Sprintf(" Pod %s (spec version %s) with following apps:", p.uuid.String(), pm.ACVersion.String()))
for _, pApp := range pm.Apps {
lines = append(lines, fmt.Sprintf(" %s", appLine(degradeRuntimeApp(pApp))))
}
return fmt.Errorf("%s", strings.Join(lines, "\n"))
}