diff options
| author | apocelipes <seve3r@outlook.com> | 2025-02-05 00:37:18 +0000 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2025-02-04 17:20:47 -0800 |
| commit | a1ea78c470d3136b7aed42a4d8b94497563f98ea (patch) | |
| tree | eeff0948e18d8ac6087b9120f0be65ab64fd13af /src/net/http/fs.go | |
| parent | 0e35fb2f99ce4c249c0a42ad93a597835ae742b5 (diff) | |
| download | go-a1ea78c470d3136b7aed42a4d8b94497563f98ea.tar.xz | |
net: use strings.SplitSeq and bytes.SplitSeq
Replace `for _, s := range {strings, bytes}.Split(v, sep)` with
`for s := range {strings, bytes}.SplitSeq(v, sep)`, to simplify
the code and reduce some memory allocations.
Change-Id: Idead4de1e3928fc75cc5ba8caeff85542f1243d5
GitHub-Last-Rev: 5fb196a073e7583b23b1ebb446d6c067580ed63a
GitHub-Pull-Request: golang/go#71554
Reviewed-on: https://go-review.googlesource.com/c/go/+/646216
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/net/http/fs.go')
| -rw-r--r-- | src/net/http/fs.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/net/http/fs.go b/src/net/http/fs.go index e990f196d6..48ba05a664 100644 --- a/src/net/http/fs.go +++ b/src/net/http/fs.go @@ -1014,7 +1014,7 @@ func parseRange(s string, size int64) ([]httpRange, error) { } var ranges []httpRange noOverlap := false - for _, ra := range strings.Split(s[len(b):], ",") { + for ra := range strings.SplitSeq(s[len(b):], ",") { ra = textproto.TrimString(ra) if ra == "" { continue |
