This commit is contained in:
Ricardo Gerardi 2020-05-14 03:25:47 +00:00 提交者 GitHub
當前提交 81dc6e591b
沒有發現已知的金鑰在資料庫的簽署中
GPG 金鑰 ID: 4AEE18F83AFDEB23
共有 2 個檔案被更改,包括 4 行新增0 行删除

查看文件

@ -987,10 +987,12 @@ func TestToIntSliceE(t *testing.T) {
{[]interface{}{1.2, 3.2}, []int{1, 3}, false},
{[]string{"2", "3"}, []int{2, 3}, false},
{[2]string{"2", "3"}, []int{2, 3}, false},
{"2 3", []int{2, 3}, false},
// errors
{nil, nil, true},
{testing.T{}, nil, true},
{[]string{"foo", "bar"}, nil, true},
{"2 a", []int{}, true},
}
for i, test := range tests {

查看文件

@ -1151,6 +1151,8 @@ func ToIntSliceE(i interface{}) ([]int, error) {
switch v := i.(type) {
case []int:
return v, nil
case string:
return ToIntSliceE(strings.Fields(v))
}
kind := reflect.TypeOf(i).Kind()