From e9052a47733d12e1232f32e49006642e1c21bf97 Mon Sep 17 00:00:00 2001 From: Twiink Date: Wed, 18 Nov 2026 15:28:06 +0800 Subject: [PATCH] =?UTF-8?q?fix(slice):=20=E4=BF=AE=E5=A4=8D=E5=AD=97?= =?UTF-8?q?=E7=AC=A6=E4=B8=B2=E6=8C=87=E9=92=88=E7=9A=84=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E6=8B=86=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- slice.go | 3 ++- slice_test.go | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/slice.go b/slice.go index e6a8328c..221c551f 100644 --- a/slice.go +++ b/slice.go @@ -89,8 +89,9 @@ func ToStringSliceE(i any) ([]string, error) { } var a []string + value, _ := indirect(i) - switch v := i.(type) { + switch v := value.(type) { case string: return strings.Fields(v), nil case any: diff --git a/slice_test.go b/slice_test.go index fb7597cc..4f3e1afa 100644 --- a/slice_test.go +++ b/slice_test.go @@ -244,6 +244,7 @@ func TestSlice(t *testing.T) { func TestStringSlice(t *testing.T) { testCases := []testCase{ + {"one\ttwo three", []string{"one", "two", "three"}, false}, {[]int{1, 2}, []string{"1", "2"}, false}, {[]int8{int8(1), int8(2)}, []string{"1", "2"}, false}, {[]int32{int32(1), int32(2)}, []string{"1", "2"}, false},