Fix Travis build

This commit is contained in:
Bjørn Erik Pedersen 2018-10-25 00:49:29 +02:00
parent 76b6d6c500
commit 8c9545af88
5 changed files with 18 additions and 5 deletions

View File

@ -1,7 +1,8 @@
language: go language: go
env:
- GO111MODULE=on
sudo: required sudo: required
go: go:
- "1.10.x"
- "1.11.x" - "1.11.x"
- tip - tip
os: os:

View File

@ -872,7 +872,7 @@ func TestToStringMapInt64E(t *testing.T) {
{map[string]int32{"v1": int32(33), "v2": int32(88)}, map[string]int64{"v1": 33, "v2": 88}, false}, {map[string]int32{"v1": int32(33), "v2": int32(88)}, map[string]int64{"v1": 33, "v2": 88}, false},
{map[string]uint16{"v1": uint16(33), "v2": uint16(88)}, map[string]int64{"v1": 33, "v2": 88}, false}, {map[string]uint16{"v1": uint16(33), "v2": uint16(88)}, map[string]int64{"v1": 33, "v2": 88}, false},
{map[string]float64{"v1": float64(8.22), "v2": float64(43.32)}, map[string]int64{"v1": 8, "v2": 43}, false}, {map[string]float64{"v1": float64(8.22), "v2": float64(43.32)}, map[string]int64{"v1": 8, "v2": 43}, false},
{`{"v1": 67, "v2": 56}`, map[string]int64{"v1": 67, "v2": 56}, false}, {`{"v1": 67, "v2": 56}`, map[string]int64{"v1": 67, "v2": 56}, false},
// errors // errors
{nil, nil, true}, {nil, nil, true},

View File

@ -991,7 +991,7 @@ func ToStringMapE(i interface{}) (map[string]interface{}, error) {
} }
// ToStringMapIntE casts an interface to a map[string]int{} type. // ToStringMapIntE casts an interface to a map[string]int{} type.
func ToStringMapIntE(i interface{}) (map[string]int, error) { func ToStringMapIntE(i interface{}) (map[string]int, error) {
var m = map[string]int{} var m = map[string]int{}
if i == nil { if i == nil {
return m, fmt.Errorf("unable to cast %#v of type %T to map[string]int", i, i) return m, fmt.Errorf("unable to cast %#v of type %T to map[string]int", i, i)
@ -1032,7 +1032,7 @@ func ToStringMapIntE(i interface{}) (map[string]int, error) {
} }
// ToStringMapInt64E casts an interface to a map[string]int64{} type. // ToStringMapInt64E casts an interface to a map[string]int64{} type.
func ToStringMapInt64E(i interface{}) (map[string]int64, error) { func ToStringMapInt64E(i interface{}) (map[string]int64, error) {
var m = map[string]int64{} var m = map[string]int64{}
if i == nil { if i == nil {
return m, fmt.Errorf("unable to cast %#v of type %T to map[string]int64", i, i) return m, fmt.Errorf("unable to cast %#v of type %T to map[string]int64", i, i)
@ -1222,7 +1222,7 @@ func StringToDate(s string) (time.Time, error) {
"2006-01-02 15:04:05 -07:00", "2006-01-02 15:04:05 -07:00",
"2006-01-02 15:04:05 -0700", "2006-01-02 15:04:05 -0700",
"2006-01-02 15:04:05Z07:00", // RFC3339 without T "2006-01-02 15:04:05Z07:00", // RFC3339 without T
"2006-01-02 15:04:05Z0700", // RFC3339 without T or timezone hh:mm colon "2006-01-02 15:04:05Z0700", // RFC3339 without T or timezone hh:mm colon
"2006-01-02 15:04:05", "2006-01-02 15:04:05",
time.Kitchen, time.Kitchen,
time.Stamp, time.Stamp,

6
go.mod
View File

@ -1 +1,7 @@
module github.com/spf13/cast module github.com/spf13/cast
require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/testify v1.2.2
)

6
go.sum Normal file
View File

@ -0,0 +1,6 @@
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=