From cb6500b99335a80247f5c5ea0cf89ff0f1586ed6 Mon Sep 17 00:00:00 2001 From: Alberto Bertogli Date: Wed, 1 Mar 2017 10:14:39 +0000 Subject: [PATCH] sts: Don't use expvar.Int.Value in tests, for Go 1.7 compatibility expvar.Int.Value appeared in Go 1.8, but we want to keep compatibility with Go 1.7 at least until the next release. So this patch replaces the use of expvar.Int.Value in tests, to make them compatible with Go 1.7 again. --- internal/sts/sts_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/sts/sts_test.go b/internal/sts/sts_test.go index 0b74906..bc26940 100644 --- a/internal/sts/sts_test.go +++ b/internal/sts/sts_test.go @@ -8,6 +8,7 @@ import ( "net/http" "net/http/httptest" "os" + "strconv" "testing" "time" ) @@ -191,8 +192,9 @@ func mustTempDir(t *testing.T) string { return dir } -func expvarMustEq(t *testing.T, name string, v *expvar.Int, expected int64) { - value := v.Value() +func expvarMustEq(t *testing.T, name string, v *expvar.Int, expected int) { + // TODO: Use v.Value once we drop support of Go 1.7. + value, _ := strconv.Atoi(v.String()) if value != expected { t.Errorf("%s is %d, expected %d", name, value, expected) }