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


Golang logger.Panicf函数代码示例

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


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


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