mirror of https://github.com/golang/go.git
testing: use strings.SplitSeq and bytes.SplitSeq
To simplify the code. This is a follow up for the CL 646216.
This commit is contained in:
parent
842e4b5207
commit
2e7a6ad40c
|
|
@ -23,7 +23,7 @@ func Example_parsing() {
|
|||
|
||||
results := func() []map[string]any {
|
||||
var ms []map[string]any
|
||||
for _, line := range bytes.Split(buf.Bytes(), []byte{'\n'}) {
|
||||
for line := range bytes.SplitSeq(buf.Bytes(), []byte{'\n'}) {
|
||||
if len(line) == 0 {
|
||||
continue
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2501,7 +2501,7 @@ func (m *M) stopAlarm() {
|
|||
}
|
||||
|
||||
func parseCpuList() {
|
||||
for _, val := range strings.Split(*cpuListStr, ",") {
|
||||
for val := range strings.SplitSeq(*cpuListStr, ",") {
|
||||
val = strings.TrimSpace(val)
|
||||
if val == "" {
|
||||
continue
|
||||
|
|
|
|||
|
|
@ -894,7 +894,7 @@ func TestRunningTestsInCleanup(t *testing.T) {
|
|||
|
||||
func parseRunningTests(out []byte) (runningTests []string, ok bool) {
|
||||
inRunningTests := false
|
||||
for _, line := range strings.Split(string(out), "\n") {
|
||||
for line := range strings.SplitSeq(string(out), "\n") {
|
||||
if inRunningTests {
|
||||
// Package testing adds one tab, the panic printer adds another.
|
||||
if trimmed, ok := strings.CutPrefix(line, "\t\t"); ok {
|
||||
|
|
|
|||
Loading…
Reference in New Issue