Documentation ¶
Overview ¶
Package foreach provides allocation-conscious helpers for iterating over lines of text.
They're factored out into a separate small package primarily to allow them to have allocation-measuring tests that need to run without interference from other goroutine-leaking tests.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Line ¶
Line calls f on each line in v, without the trailing '\n'. The final line need not include a trailing '\n'. Returns first non-nil error returned by f.
Example ¶
package main import ( "fmt" "golang.org/x/build/internal/foreach" ) func main() { v := []byte(`line 1 line 2 line 3 after two blank lines last line`) foreach.Line(v, func(b []byte) error { fmt.Printf("%q\n", b) return nil }) }
Output: "line 1" "line 2" "line 3" "" "" "after two blank lines" "last line"
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.