aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2018-03-21 16:25:58 -0700
committerColin Cross <ccross@android.com>2018-05-03 14:38:12 -0700
commita4ffa9addbd995be5acd9cbfddeb0821790a014b (patch)
tree8be08dded9a5de0fc00f33d8299503a0534f873e
parent8a32a05989ab6c6a675ae8e0d05104c398e774a4 (diff)
downloadbuild_soong-a4ffa9addbd995be5acd9cbfddeb0821790a014b.tar.gz
build_soong-a4ffa9addbd995be5acd9cbfddeb0821790a014b.tar.bz2
build_soong-a4ffa9addbd995be5acd9cbfddeb0821790a014b.zip
Fix format string issues
Fix issues caught by go vet. Bug: 73724997 Test: m checkbuild Change-Id: Ib8d740457c15432dabe1575a6707726ddaf93084 Merged-In: Ib8d740457c15432dabe1575a6707726ddaf93084 (cherry picked from commit f46e37f5f79bd7111aed84f6cf172f20431ec010)
-rw-r--r--androidmk/cmd/androidmk/android.go4
-rw-r--r--bpfix/bpfix/bpfix.go2
-rw-r--r--cc/cc_test.go2
-rw-r--r--cmd/extract_linker/main.go8
-rw-r--r--cmd/pom2mk/pom2mk.go2
-rw-r--r--cmd/zipsync/zipsync.go4
-rw-r--r--ui/logger/logger.go2
-rw-r--r--ui/logger/logger_test.go2
8 files changed, 13 insertions, 13 deletions
diff --git a/androidmk/cmd/androidmk/android.go b/androidmk/cmd/androidmk/android.go
index 5196754e..b2a8914e 100644
--- a/androidmk/cmd/androidmk/android.go
+++ b/androidmk/cmd/androidmk/android.go
@@ -259,7 +259,7 @@ func classifyLocalOrGlobalPath(value bpparser.Expression) (string, bpparser.Expr
}
case *bpparser.Operator:
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 != '+' {
@@ -290,7 +290,7 @@ func classifyLocalOrGlobalPath(value bpparser.Expression) (string, bpparser.Expr
case *bpparser.String:
return "global", value, nil
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())
}
}
diff --git a/bpfix/bpfix/bpfix.go b/bpfix/bpfix/bpfix.go
index 84454907..2c3cc6cd 100644
--- a/bpfix/bpfix/bpfix.go
+++ b/bpfix/bpfix/bpfix.go
@@ -67,7 +67,7 @@ func FixTree(tree *parser.File, config FixRequest) error {
// detect infinite loop
i++
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
}
}
diff --git a/cc/cc_test.go b/cc/cc_test.go
index a4e25349..10c1aba7 100644
--- a/cc/cc_test.go
+++ b/cc/cc_test.go
@@ -264,7 +264,7 @@ func checkVndkModule(t *testing.T, ctx *android.TestContext, name, subDir string
mod := ctx.ModuleForTests(name, vendorVariant).Module().(*Module)
if !mod.hasVendorVariant() {
- t.Error("%q must have vendor variant", name)
+ t.Errorf("%q must have vendor variant", name)
}
// Check library properties.
diff --git a/cmd/extract_linker/main.go b/cmd/extract_linker/main.go
index 8530b4aa..3f24ab2d 100644
--- a/cmd/extract_linker/main.go
+++ b/cmd/extract_linker/main.go
@@ -68,7 +68,7 @@ func main() {
ef, err := elf.NewFile(f)
if err != nil {
- log.Fatal("Unable to read elf file: %v", err)
+ log.Fatalf("Unable to read elf file: %v", err)
}
asm := &bytes.Buffer{}
@@ -123,17 +123,17 @@ func main() {
if asmPath != "" {
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 != "" {
buf := &bytes.Buffer{}
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 {
- log.Fatal("Unable to write %q: %v", scriptPath, err)
+ log.Fatalf("Unable to write %q: %v", scriptPath, err)
}
}
}
diff --git a/cmd/pom2mk/pom2mk.go b/cmd/pom2mk/pom2mk.go
index 57416243..fc836411 100644
--- a/cmd/pom2mk/pom2mk.go
+++ b/cmd/pom2mk/pom2mk.go
@@ -406,7 +406,7 @@ Usage: %s [--rewrite <regex>=<replace>] [-exclude <module>] [--extra-deps <modul
dir := flag.Arg(0)
absDir, err := filepath.Abs(dir)
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)
}
diff --git a/cmd/zipsync/zipsync.go b/cmd/zipsync/zipsync.go
index 035a1455..1b300161 100644
--- a/cmd/zipsync/zipsync.go
+++ b/cmd/zipsync/zipsync.go
@@ -93,11 +93,11 @@ func main() {
}
}
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 {
- 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
diff --git a/ui/logger/logger.go b/ui/logger/logger.go
index 15c413dd..c763e50c 100644
--- a/ui/logger/logger.go
+++ b/ui/logger/logger.go
@@ -85,7 +85,7 @@ func fileRotation(from, baseName, ext string, cur, max int) error {
}
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
}
diff --git a/ui/logger/logger_test.go b/ui/logger/logger_test.go
index dc6f2e91..bdf0231a 100644
--- a/ui/logger/logger_test.go
+++ b/ui/logger/logger_test.go
@@ -106,7 +106,7 @@ func TestPanic(t *testing.T) {
if p == panicValue {
os.Exit(42)
} 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)
}
}()