mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-18 14:47:03 +00:00
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.
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user