-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.
Milestone
Description
8737dac caused a regression where the functionality of Trim changed with an invalid cutset.
Consider the following test:
func Test(t *testing.T) {
s1 := strings.Trim("\x80test\xff", "\xff")
s2 := bytes.Trim([]byte("\x80test\xff"), "\xff")
if s1 != string(s2) {
t.Errorf("Trim() = %q, want %q", s1, s2)
}
}On Go 1.7, this passes with s1==s2=="test"
On tip, this fails with s1=="\x80test\xff" and s2=="test"
The string passed into the cutset is an invalid UTF-8 string, but I have actually seen a few instances of this in production code (filed a lint check for this: golang/lint#252). Regardless, the behavior of this edge case should be preserved from Go 1.7 to Go 1.8.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.