diff options
Diffstat (limited to 'src/bytes/bytes.go')
| -rw-r--r-- | src/bytes/bytes.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/bytes/bytes.go b/src/bytes/bytes.go index 08fc14d837..bdd55fca4a 100644 --- a/src/bytes/bytes.go +++ b/src/bytes/bytes.go @@ -788,6 +788,11 @@ func TrimSpace(s []byte) []byte { // At this point s[start:stop] starts and ends with an ASCII // non-space bytes, so we're done. Non-ASCII cases have already // been handled above. + if start == stop { + // Special case to preserve previous TrimLeftFunc behavior, + // returning nil instead of empty slice if all spaces. + return nil + } return s[start:stop] } |
