Skip to content

Commit 80c320b

Browse files
authored
chore: remove unused code (#5238)
1 parent bea9d15 commit 80c320b

File tree

2 files changed

+18
-47
lines changed

2 files changed

+18
-47
lines changed

tools/goctl/util/string.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package util
22

33
import (
44
"slices"
5-
"strconv"
65
"strings"
76

87
"github.com/zeromicro/go-zero/tools/goctl/util/console"
@@ -130,14 +129,3 @@ func FieldsAndTrimSpace(s string, f func(r rune) bool) []string {
130129
}
131130
return resp
132131
}
133-
134-
//Deprecated: This function implementation is incomplete and does not properly handle exceptional input cases.
135-
//We strongly recommend using the standard library's strconv.Unquote function instead,
136-
//which provides robust error handling and comprehensive support for various input formats.
137-
func Unquote(s string) string {
138-
ns, err := strconv.Unquote(s)
139-
if err != nil {
140-
return ""
141-
}
142-
return ns
143-
}

tools/goctl/util/string_test.go

Lines changed: 18 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -76,40 +76,40 @@ func TestEscapeGoKeyword(t *testing.T) {
7676

7777
func TestFieldsAndTrimSpace(t *testing.T) {
7878
testCases := []struct {
79-
name string
80-
input string
79+
name string
80+
input string
8181
delimiter func(r rune) bool
82-
expected []string
82+
expected []string
8383
}{
8484
{
85-
name: "Comma-separated values",
86-
input: "a, b, c",
85+
name: "Comma-separated values",
86+
input: "a, b, c",
8787
delimiter: func(r rune) bool { return r == ',' },
88-
expected: []string{"a", " b", " c"},
88+
expected: []string{"a", " b", " c"},
8989
},
9090
{
91-
name: "Space-separated values",
92-
input: "a b c",
91+
name: "Space-separated values",
92+
input: "a b c",
9393
delimiter: unicode.IsSpace,
94-
expected: []string{"a", "b", "c"},
94+
expected: []string{"a", "b", "c"},
9595
},
9696
{
97-
name: "Mixed whitespace",
98-
input: "a\tb\nc",
97+
name: "Mixed whitespace",
98+
input: "a\tb\nc",
9999
delimiter: unicode.IsSpace,
100-
expected: []string{"a", "b", "c"},
100+
expected: []string{"a", "b", "c"},
101101
},
102102
{
103-
name: "Empty input",
104-
input: "",
103+
name: "Empty input",
104+
input: "",
105105
delimiter: unicode.IsSpace,
106-
expected: []string(nil),
106+
expected: []string(nil),
107107
},
108108
{
109-
name: "Trailing and leading spaces",
110-
input: " a , b , c ",
109+
name: "Trailing and leading spaces",
110+
input: " a , b , c ",
111111
delimiter: func(r rune) bool { return r == ',' },
112-
expected: []string{" a ", " b ", " c "},
112+
expected: []string{" a ", " b ", " c "},
113113
},
114114
}
115115

@@ -120,20 +120,3 @@ func TestFieldsAndTrimSpace(t *testing.T) {
120120
})
121121
}
122122
}
123-
124-
func TestUnquote(t *testing.T) {
125-
testCases := []struct {
126-
input string
127-
expected string
128-
}{
129-
{input: `"hello"`, expected: `hello`},
130-
{input: "`world`", expected: `world`},
131-
{input: `"foo'bar"`, expected: `foo'bar`},
132-
{input: "", expected: ""},
133-
}
134-
135-
for _, tc := range testCases {
136-
result := Unquote(tc.input)
137-
assert.Equal(t, tc.expected, result)
138-
}
139-
}

0 commit comments

Comments
 (0)