• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang logger.Panicf函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/ubuntu-core/snappy/logger.Panicf函数的典型用法代码示例。如果您正苦于以下问题:Golang Panicf函数的具体用法?Golang Panicf怎么用?Golang Panicf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Panicf函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: Parser

// Parser creates and populates a fresh parser.
// Since commands have local state a fresh parser is required to isolate tests
// from each other.
func Parser() *flags.Parser {
	parser := flags.NewParser(&optionsData, flags.HelpFlag|flags.PassDoubleDash)
	// Add all regular commands
	for _, c := range commands {
		cmd, err := parser.AddCommand(c.name, c.shortHelp, strings.TrimSpace(c.longHelp), c.builder())
		if err != nil {

			logger.Panicf("cannot add command %q: %v", c.name, err)
		}
		cmd.Hidden = c.hidden
	}
	// Add the experimental command
	experimentalCommand, err := parser.AddCommand("experimental", shortExperimentalHelp, longExperimentalHelp, &cmdExperimental{})
	experimentalCommand.Hidden = true
	if err != nil {
		logger.Panicf("cannot add command %q: %v", "experimental", err)
	}
	// Add all the sub-commands of the experimental command
	for _, c := range experimentalCommands {
		cmd, err := experimentalCommand.AddCommand(c.name, c.shortHelp, strings.TrimSpace(c.longHelp), c.builder())
		if err != nil {
			logger.Panicf("cannot add experimental command %q: %v", c.name, err)
		}
		cmd.Hidden = c.hidden
	}
	return parser
}
开发者ID:dholbach,项目名称:snappy,代码行数:30,代码来源:main.go


示例2: init

func init() {
	_, err := parser.AddCommand("enable-classic",
		i18n.G("Enable classic dimension."),
		i18n.G("Enable the ubuntu classic dimension."),
		&cmdEnableClassic{})
	if err != nil {
		logger.Panicf("Unable to enable-classic: %v", err)
	}

	_, err = parser.AddCommand("destroy-classic",
		i18n.G("Destroy the classic dimension."),
		i18n.G("Destroy the ubuntu classic dimension."),
		&cmdDestroyClassic{})
	if err != nil {
		logger.Panicf("Unable to destroy-classic: %v", err)
	}
}
开发者ID:robert-ancell,项目名称:snapd,代码行数:17,代码来源:cmd_classic.go


示例3: init

func init() {
	_, err := parser.AddCommand("activate",
		i18n.G(`Activate a package`),
		i18n.G(`Activate a package that has previously been deactivated. If the package is already activated, do nothing.`),
		&cmdActivate{activate: true})
	if err != nil {
		logger.Panicf("Unable to activate: %v", err)
	}

	_, err = parser.AddCommand("deactivate",
		i18n.G(`Deactivate a package`),
		i18n.G(`Deactivate a package. If the package is already deactivated, do nothing.`),
		&cmdActivate{activate: false})
	if err != nil {
		logger.Panicf("Unable to deactivate: %v", err)
	}
}
开发者ID:robert-ancell,项目名称:snapd,代码行数:17,代码来源:cmd_activate.go


示例4: set

func (data customData) set(key string, value interface{}) {
	serialized, err := json.Marshal(value)
	if err != nil {
		logger.Panicf("internal error: could not marshal value for state entry %q: %v", key, err)
	}
	entryJSON := json.RawMessage(serialized)
	data[key] = &entryJSON
}
开发者ID:dholbach,项目名称:snappy,代码行数:8,代码来源:state.go


示例5: checkpointData

func (s *State) checkpointData() []byte {
	data, err := json.Marshal(s)
	if err != nil {
		// this shouldn't happen, because the actual delicate serializing happens at various Set()s
		logger.Panicf("internal error: could not marshal state for checkpointing: %v", err)
	}
	return data
}
开发者ID:dholbach,项目名称:snappy,代码行数:8,代码来源:state.go


示例6: init

func init() {
	_, err := parser.AddCommand("grub-migrate",
		"internal",
		"internal",
		&cmdGrubMigrate{})
	if err != nil {
		logger.Panicf("Unable to grub-migrate: %v", err)
	}
}
开发者ID:General-Beck,项目名称:snappy,代码行数:9,代码来源:cmd_grub_migrate.go


示例7: init

func init() {
	_, err := parser.AddCommand("versions",
		shortVersionsHelp,
		longVersionsHelp,
		&cmdVersions{})
	if err != nil {
		logger.Panicf("Unable to versions: %v", err)
	}
}
开发者ID:robert-ancell,项目名称:snapd,代码行数:9,代码来源:cmd_versions.go


示例8: init

func init() {
	_, err := parser.AddCommand("console",
		"Run snappy console interface",
		"Run snappy console interface",
		&cmdConsole{})
	if err != nil {
		logger.Panicf("Unable to console: %v", err)
	}
}
开发者ID:General-Beck,项目名称:snappy,代码行数:9,代码来源:cmd_console.go


示例9: init

func init() {
	_, err := parser.AddCommand("firstboot",
		"internal",
		"internal",
		&cmdInternalFirstBootOemConfig{})
	if err != nil {
		logger.Panicf("Unable to first_boot: %v", err)
	}
}
开发者ID:General-Beck,项目名称:snappy,代码行数:9,代码来源:cmd_first_boot.go


示例10: init

func init() {
	_, err := parser.AddCommand("booted",
		"internal",
		"internal",
		&cmdBooted{})
	if err != nil {
		logger.Panicf("Unable to booted: %v", err)
	}
}
开发者ID:robert-ancell,项目名称:snapd,代码行数:9,代码来源:cmd_booted.go


示例11: init

func init() {
	_, err := parser.AddCommand("internal-run-hooks",
		"internal",
		"internal",
		&cmdInternalRunHooks{})
	if err != nil {
		logger.Panicf("Unable to internal_run_hooks: %v", err)
	}
}
开发者ID:pombredanne,项目名称:snappy-1,代码行数:9,代码来源:cmd_internal_run_hooks.go


示例12: init

func init() {
	_, err := parser.AddCommand("set",
		i18n.G("Set properties of system or package"),
		setHelp,
		&cmdSet{})
	if err != nil {
		logger.Panicf("Unable to set: %v", err)
	}
}
开发者ID:robert-ancell,项目名称:snapd,代码行数:9,代码来源:cmd_set.go


示例13: init

func init() {
	_, err := parser.AddCommand("internal-unpack",
		"internal",
		"internal",
		&cmdInternalUnpack{})
	if err != nil {
		logger.Panicf("Unable to internal_unpack: %v", err)
	}
}
开发者ID:General-Beck,项目名称:snappy,代码行数:9,代码来源:cmd_internal_unpack.go


示例14: init

func init() {
	arg, err := parser.AddCommand("hw-info",
		shortHWInfoHelp,
		longHWInfoHelp,
		&cmdHWInfo{})
	if err != nil {
		logger.Panicf("Unable to hwinfo: %v", err)
	}
	addOptionDescription(arg, "package name", i18n.G("List assigned hardware for a specific installed package"))
}
开发者ID:robert-ancell,项目名称:snapd,代码行数:10,代码来源:cmd_hwinfo.go


示例15: init

func init() {
	arg, err := parser.AddCommand("shell",
		i18n.G("Run snappy shell interface"),
		i18n.G("Run snappy shell interface"),
		&cmdShell{})
	if err != nil {
		logger.Panicf("Unable to add shell command: %q", err)
	}
	addOptionDescription(arg, "shell-type", i18n.G("The type of shell you want"))
}
开发者ID:robert-ancell,项目名称:snapd,代码行数:10,代码来源:cmd_shell.go


示例16: init

func init() {
	arg, err := parser.AddCommand("login",
		shortLoginHelp,
		longLoginHelp,
		&cmdLogin{})
	if err != nil {
		logger.Panicf("Unable to login: %v", err)
	}
	addOptionDescription(arg, "userid", i18n.G("Username for the login"))
}
开发者ID:robert-ancell,项目名称:snapd,代码行数:10,代码来源:cmd_login.go


示例17: init

func init() {
	arg, err := parser.AddCommand("purge",
		shortPurgeHelp,
		longPurgeHelp,
		&cmdPurge{})
	if err != nil {
		logger.Panicf("Unable to purge: %v", err)
	}
	addOptionDescription(arg, "installed", i18n.G("Purge an installed package."))
}
开发者ID:robert-ancell,项目名称:snapd,代码行数:10,代码来源:cmd_purge.go


示例18: init

func init() {
	arg, err := parser.AddCommand("remove",
		i18n.G("Remove a snapp part"),
		i18n.G("Remove a snapp part"),
		&cmdRemove{})
	if err != nil {
		logger.Panicf("Unable to remove: %v", err)
	}
	addOptionDescription(arg, "no-gc", i18n.G("Do not clean up old versions of the package."))
}
开发者ID:robert-ancell,项目名称:snapd,代码行数:10,代码来源:cmd_remove.go


示例19: init

func init() {
	arg, err := parser.AddCommand("config",
		shortConfigHelp,
		longConfigHelp,
		&cmdConfig{})
	if err != nil {
		logger.Panicf("Unable to config: %v", err)
	}
	addOptionDescription(arg, "package name", i18n.G("Set configuration for a specific installed package"))
	addOptionDescription(arg, "config file", i18n.G("The configuration for the given file"))
}
开发者ID:alecu,项目名称:snappy,代码行数:11,代码来源:cmd_config.go


示例20: init

func init() {
	_, err := parser.AddCommand("service",
		i18n.G("Query and modify snappy services"),
		i18n.G("Query and modify snappy services of locally-installed packages"),
		&cmdService{})

	if err != nil {
		logger.Panicf("Unable to service: %v", err)
	}

}
开发者ID:robert-ancell,项目名称:snapd,代码行数:11,代码来源:cmd_service.go



注:本文中的github.com/ubuntu-core/snappy/logger.Panicf函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang osutil.FileExists函数代码示例发布时间:2022-05-28
下一篇:
Golang logger.Noticef函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap