Fix format string issues
Fix issues caught by go vet. Test: m checkbuild Change-Id: Ib8d740457c15432dabe1575a6707726ddaf93084
This commit is contained in:
@@ -258,7 +258,7 @@ func classifyLocalOrGlobalPath(value bpparser.Expression) (string, bpparser.Expr
|
|||||||
}
|
}
|
||||||
case *bpparser.Operator:
|
case *bpparser.Operator:
|
||||||
if v.Type() != bpparser.StringType {
|
if v.Type() != bpparser.StringType {
|
||||||
return "", nil, fmt.Errorf("classifyLocalOrGlobalPath expected a string, got %s", value.Type)
|
return "", nil, fmt.Errorf("classifyLocalOrGlobalPath expected a string, got %s", v.Type())
|
||||||
}
|
}
|
||||||
|
|
||||||
if v.Operator != '+' {
|
if v.Operator != '+' {
|
||||||
@@ -289,7 +289,7 @@ func classifyLocalOrGlobalPath(value bpparser.Expression) (string, bpparser.Expr
|
|||||||
case *bpparser.String:
|
case *bpparser.String:
|
||||||
return "global", value, nil
|
return "global", value, nil
|
||||||
default:
|
default:
|
||||||
return "", nil, fmt.Errorf("classifyLocalOrGlobalPath expected a string, got %s", value.Type)
|
return "", nil, fmt.Errorf("classifyLocalOrGlobalPath expected a string, got %s", v.Type())
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -67,7 +67,7 @@ func FixTree(tree *parser.File, config FixRequest) error {
|
|||||||
// detect infinite loop
|
// detect infinite loop
|
||||||
i++
|
i++
|
||||||
if i >= maxNumIterations {
|
if i >= maxNumIterations {
|
||||||
return fmt.Errorf("Applied fixes %s times and yet the tree continued to change. Is there an infinite loop?", i)
|
return fmt.Errorf("Applied fixes %d times and yet the tree continued to change. Is there an infinite loop?", i)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -227,7 +227,7 @@ func checkVndkModule(t *testing.T, ctx *android.TestContext, name, subDir string
|
|||||||
|
|
||||||
mod := ctx.ModuleForTests(name, vendorVariant).Module().(*Module)
|
mod := ctx.ModuleForTests(name, vendorVariant).Module().(*Module)
|
||||||
if !mod.hasVendorVariant() {
|
if !mod.hasVendorVariant() {
|
||||||
t.Error("%q must have vendor variant", name)
|
t.Errorf("%q must have vendor variant", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check library properties.
|
// Check library properties.
|
||||||
|
@@ -68,7 +68,7 @@ func main() {
|
|||||||
|
|
||||||
ef, err := elf.NewFile(f)
|
ef, err := elf.NewFile(f)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("Unable to read elf file: %v", err)
|
log.Fatalf("Unable to read elf file: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
asm := &bytes.Buffer{}
|
asm := &bytes.Buffer{}
|
||||||
@@ -123,17 +123,17 @@ func main() {
|
|||||||
|
|
||||||
if asmPath != "" {
|
if asmPath != "" {
|
||||||
if err := ioutil.WriteFile(asmPath, asm.Bytes(), 0777); err != nil {
|
if err := ioutil.WriteFile(asmPath, asm.Bytes(), 0777); err != nil {
|
||||||
log.Fatal("Unable to write %q: %v", asmPath, err)
|
log.Fatalf("Unable to write %q: %v", asmPath, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if scriptPath != "" {
|
if scriptPath != "" {
|
||||||
buf := &bytes.Buffer{}
|
buf := &bytes.Buffer{}
|
||||||
if err := linkerScriptTemplate.Execute(buf, sections); err != nil {
|
if err := linkerScriptTemplate.Execute(buf, sections); err != nil {
|
||||||
log.Fatal("Failed to create linker script: %v", err)
|
log.Fatalf("Failed to create linker script: %v", err)
|
||||||
}
|
}
|
||||||
if err := ioutil.WriteFile(scriptPath, buf.Bytes(), 0777); err != nil {
|
if err := ioutil.WriteFile(scriptPath, buf.Bytes(), 0777); err != nil {
|
||||||
log.Fatal("Unable to write %q: %v", scriptPath, err)
|
log.Fatalf("Unable to write %q: %v", scriptPath, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -305,7 +305,7 @@ The makefile is written to stdout, to be put in the current directory (often as
|
|||||||
dir := flag.Arg(0)
|
dir := flag.Arg(0)
|
||||||
absDir, err := filepath.Abs(dir)
|
absDir, err := filepath.Abs(dir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(os.Stderr, "Failed to get absolute directory:", err)
|
fmt.Fprintln(os.Stderr, "Failed to get absolute directory:", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -93,11 +93,11 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if filepath.IsAbs(f.Name) {
|
if filepath.IsAbs(f.Name) {
|
||||||
log.Fatal("%q in %q is an absolute path", f.Name, input)
|
log.Fatalf("%q in %q is an absolute path", f.Name, input)
|
||||||
}
|
}
|
||||||
|
|
||||||
if prev, exists := seen[f.Name]; exists {
|
if prev, exists := seen[f.Name]; exists {
|
||||||
log.Fatal("%q found in both %q and %q", f.Name, prev, input)
|
log.Fatalf("%q found in both %q and %q", f.Name, prev, input)
|
||||||
}
|
}
|
||||||
seen[f.Name] = input
|
seen[f.Name] = input
|
||||||
|
|
||||||
|
@@ -85,7 +85,7 @@ func fileRotation(from, baseName, ext string, cur, max int) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := os.Rename(from, newName); err != nil {
|
if err := os.Rename(from, newName); err != nil {
|
||||||
return fmt.Errorf("Failed to rotate", from, "to", newName, ".", err)
|
return fmt.Errorf("Failed to rotate %s to %s. %s", from, newName, err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@@ -106,7 +106,7 @@ func TestPanic(t *testing.T) {
|
|||||||
if p == panicValue {
|
if p == panicValue {
|
||||||
os.Exit(42)
|
os.Exit(42)
|
||||||
} else {
|
} else {
|
||||||
fmt.Fprintln(os.Stderr, "Expected %q, got %v", panicValue, p)
|
fmt.Fprintf(os.Stderr, "Expected %q, got %v\n", panicValue, p)
|
||||||
os.Exit(3)
|
os.Exit(3)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
Reference in New Issue
Block a user