当前位置: 首页>>代码示例>>Golang>>正文


Golang ImageManifest.UnmarshalJSON方法代码示例

本文整理汇总了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"))
}
开发者ID:kinpro,项目名称:rkt,代码行数:17,代码来源:image_list.go

示例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"))
}
开发者ID:derekparker,项目名称:rkt,代码行数:24,代码来源:list.go


注:本文中的github.com/coreos/rkt/Godeps/_workspace/src/github.com/appc/spec/schema/lastditch.ImageManifest.UnmarshalJSON方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。