all: fix fmt format errors causing vet failures during go test
Change-Id: I5638506b42cf8d8d60f7b8b25a5327f5128813ec
Reviewed-on: https://go-review.googlesource.com/80143
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
diff --git a/currency/currency_test.go b/currency/currency_test.go
index 566a167..db93a0f 100644
--- a/currency/currency_test.go
+++ b/currency/currency_test.go
@@ -105,10 +105,10 @@
}
// First currency has index 1, last is numCurrencies.
if c := currency.Elem(1)[:3]; c != "ADP" {
- t.Errorf("first was %c; want ADP", c)
+ t.Errorf("first was %q; want ADP", c)
}
if c := currency.Elem(numCurrencies)[:3]; c != "ZWR" {
- t.Errorf("last was %c; want ZWR", c)
+ t.Errorf("last was %q; want ZWR", c)
}
}
diff --git a/language/display/dict_test.go b/language/display/dict_test.go
index f0b1f78..17b1389 100644
--- a/language/display/dict_test.go
+++ b/language/display/dict_test.go
@@ -16,7 +16,7 @@
compact := getSize(t, `display.English.Languages().Name(language.English)`)
if d := base - compact; d < 1.5*1024*1024 {
- t.Errorf("size(base)-size(compact) was %d; want > 1.5MB", base, compact)
+ t.Errorf("size(base) - size(compact) = %d - %d = was %d; want > 1.5MB", base, compact, d)
}
}
diff --git a/message/fmt_test.go b/message/fmt_test.go
index 2110bb5..45baebe 100755
--- a/message/fmt_test.go
+++ b/message/fmt_test.go
@@ -1786,7 +1786,12 @@
type B struct{}
var a *A = nil
var b B = B{}
- got := p.Sprintf("%s %s %s %s %s", nil, a, nil, b, nil) // go vet should complain about this line.
+
+ // indirect the Sprintf call through this f variable to avoid
+ // "go test" failing vet checks in Go 1.10+.
+ f := p.Sprintf
+ got := f("%s %s %s %s %s", nil, a, nil, b, nil)
+
const expect = "%!s(<nil>) %!s(*message.A=<nil>) %!s(<nil>) {} %!s(<nil>)"
if got != expect {
t.Errorf("expected:\n\t%q\ngot:\n\t%q", expect, got)
diff --git a/number/format_test.go b/number/format_test.go
index 3c67c5d..9a00cc4 100644
--- a/number/format_test.go
+++ b/number/format_test.go
@@ -98,9 +98,13 @@
p := message.NewPrinter(language.English)
- got := p.Sprintf("num %f", tc.f)
+ // Indirect the call to p.Sprintf through the variable f
+ // to avoid Go 1.10+ go test failing a vet check.
+ f := p.Sprintf
+ got := f("num %f", tc.f)
+
if got != tc.want {
- t.Errorf("got %v; want %v", got, tc.want)
+ t.Errorf("got %q; want %q", got, tc.want)
}
})
}