Use constant format strings with Printf-like functions (#1013)
Recent versions of Go object to the use of non-constant variables a format strings. This commit fixes errors like this: cli.go:26:47: non-constant format string in call to fmt.Fprintf Signed-off-by: W. Michael Petullo <mike@flyn.org>
This commit is contained in:
committed by
GitHub
parent
4369957cb4
commit
8384a5683c
+1
-1
@@ -22,7 +22,7 @@ type Program struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *Program) Execute() {
|
func (p *Program) Execute() {
|
||||||
flag.Usage = func() { fmt.Fprintf(os.Stderr, p.Usage) }
|
flag.Usage = func() { fmt.Fprint(os.Stderr, p.Usage) }
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
os.Exit(p.main(flag.Args(), os.Stdin, os.Stdout, os.Stderr))
|
os.Exit(p.main(flag.Args(), os.Stdin, os.Stdout, os.Stderr))
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1034,7 +1034,7 @@ func (d *decoder) unmarshalInteger(value *unstable.Node, v reflect.Value) error
|
|||||||
case reflect.Interface:
|
case reflect.Interface:
|
||||||
r = reflect.ValueOf(i)
|
r = reflect.ValueOf(i)
|
||||||
default:
|
default:
|
||||||
return unstable.NewParserError(d.p.Raw(value.Raw), d.typeMismatchString("integer", v.Type()))
|
return unstable.NewParserError(d.p.Raw(value.Raw), "%s", d.typeMismatchString("integer", v.Type()))
|
||||||
}
|
}
|
||||||
|
|
||||||
if !r.Type().AssignableTo(v.Type()) {
|
if !r.Type().AssignableTo(v.Type()) {
|
||||||
@@ -1053,7 +1053,7 @@ func (d *decoder) unmarshalString(value *unstable.Node, v reflect.Value) error {
|
|||||||
case reflect.Interface:
|
case reflect.Interface:
|
||||||
v.Set(reflect.ValueOf(string(value.Data)))
|
v.Set(reflect.ValueOf(string(value.Data)))
|
||||||
default:
|
default:
|
||||||
return unstable.NewParserError(d.p.Raw(value.Raw), d.typeMismatchString("string", v.Type()))
|
return unstable.NewParserError(d.p.Raw(value.Raw), "%s", d.typeMismatchString("string", v.Type()))
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user