本文整理汇总了Golang中robpike/io/ivy/config.Config.Debug方法的典型用法代码示例。如果您正苦于以下问题:Golang Config.Debug方法的具体用法?Golang Config.Debug怎么用?Golang Config.Debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类robpike/io/ivy/config.Config
的用法示例。
在下文中一共展示了Config.Debug方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: printValues
// printValues neatly prints the values returned from execution, followed by a newline.
// It also handles the ')debug types' output.
// The return value reports whether it printed anything.
func printValues(conf *config.Config, writer io.Writer, values []value.Value) bool {
if len(values) == 0 {
return false
}
if conf.Debug("types") {
for i, v := range values {
if i > 0 {
fmt.Fprint(writer, ",")
}
fmt.Fprintf(writer, "%T", v)
}
fmt.Fprintln(writer)
}
printed := false
for _, v := range values {
if _, ok := v.(parse.Assignment); ok {
continue
}
s := v.Sprint(conf)
if printed && len(s) > 0 && s[len(s)-1] != '\n' {
fmt.Fprint(writer, " ")
}
fmt.Fprint(writer, s)
printed = true
}
if printed {
fmt.Fprintln(writer)
}
return printed
}
示例2: printValues
// printValues neatly prints the values returned from execution, followed by a newline.
// It also handles the ')debug types' output.
func printValues(conf *config.Config, writer io.Writer, values []value.Value) {
if len(values) == 0 {
return
}
if conf.Debug("types") {
for i, v := range values {
if i > 0 {
fmt.Fprint(writer, ",")
}
fmt.Fprintf(writer, "%T", v)
}
fmt.Fprintln(writer)
}
for i, v := range values {
s := v.Sprint(conf)
if i > 0 && len(s) > 0 && s[len(s)-1] != '\n' {
fmt.Fprint(writer, " ")
}
fmt.Fprint(writer, s)
}
fmt.Fprintln(writer)
}