1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
From: "Dr. Tobias Quathamer" <toddy@debian.org>
Date: Wed, 26 Apr 2017 21:56:15 +0200
Subject: Fix FTBFS on 32 bit architectures.
---
viper.go | 4 +++-
viper_test.go | 8 --------
2 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/viper.go b/viper.go
index 2603c78..b176b8e 100644
--- a/viper.go
+++ b/viper.go
@@ -605,8 +605,10 @@ func (v *Viper) Get(key string) interface{} {
return cast.ToBool(val)
case string:
return cast.ToString(val)
- case int64, int32, int16, int8, int:
+ case int32, int16, int8, int:
return cast.ToInt(val)
+ case int64:
+ return cast.ToInt64(val)
case float64, float32:
return cast.ToFloat64(val)
case time.Time:
diff --git a/viper_test.go b/viper_test.go
index cd7b65c..189b499 100644
--- a/viper_test.go
+++ b/viper_test.go
@@ -841,10 +841,6 @@ func TestMergeConfig(t *testing.T) {
t.Fatalf("pop != 37890, = %d", pop)
}
- if pop := v.GetInt("hello.lagrenum"); pop != 765432101234567 {
- t.Fatalf("lagrenum != 765432101234567, = %d", pop)
- }
-
if pop := v.GetInt64("hello.lagrenum"); pop != int64(765432101234567) {
t.Fatalf("int64 lagrenum != 765432101234567, = %d", pop)
}
@@ -865,10 +861,6 @@ func TestMergeConfig(t *testing.T) {
t.Fatalf("pop != 45000, = %d", pop)
}
- if pop := v.GetInt("hello.lagrenum"); pop != 7654321001234567 {
- t.Fatalf("lagrenum != 7654321001234567, = %d", pop)
- }
-
if pop := v.GetInt64("hello.lagrenum"); pop != int64(7654321001234567) {
t.Fatalf("int64 lagrenum != 7654321001234567, = %d", pop)
}
|