mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-05-14 10:20:00 +08:00
chore: remove unused code (#5238)
This commit is contained in:
@@ -2,7 +2,6 @@ package util
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"slices"
|
"slices"
|
||||||
"strconv"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/tools/goctl/util/console"
|
"github.com/zeromicro/go-zero/tools/goctl/util/console"
|
||||||
@@ -130,14 +129,3 @@ func FieldsAndTrimSpace(s string, f func(r rune) bool) []string {
|
|||||||
}
|
}
|
||||||
return resp
|
return resp
|
||||||
}
|
}
|
||||||
|
|
||||||
//Deprecated: This function implementation is incomplete and does not properly handle exceptional input cases.
|
|
||||||
//We strongly recommend using the standard library's strconv.Unquote function instead,
|
|
||||||
//which provides robust error handling and comprehensive support for various input formats.
|
|
||||||
func Unquote(s string) string {
|
|
||||||
ns, err := strconv.Unquote(s)
|
|
||||||
if err != nil {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
return ns
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -120,20 +120,3 @@ func TestFieldsAndTrimSpace(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestUnquote(t *testing.T) {
|
|
||||||
testCases := []struct {
|
|
||||||
input string
|
|
||||||
expected string
|
|
||||||
}{
|
|
||||||
{input: `"hello"`, expected: `hello`},
|
|
||||||
{input: "`world`", expected: `world`},
|
|
||||||
{input: `"foo'bar"`, expected: `foo'bar`},
|
|
||||||
{input: "", expected: ""},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, tc := range testCases {
|
|
||||||
result := Unquote(tc.input)
|
|
||||||
assert.Equal(t, tc.expected, result)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user