strings.NewReader

The Go function that turns a string into an io.Reader, so text can be fed to code that expects a stream.

In more detail

It is the quickest way to give a function test input without creating a file. The strings package also holds everyday text helpers such as Split, TrimSpace and Contains.

Example

strings.NewReader("0123456789")

Related terms

Taught in

References