terraform/vendor/github.com/mitchellh/go-linereader
Radek Simko 8005e39a0a
vendor: github.com/mitchellh/go-linereader@1b945b3263eb
go get github.com/mitchellh/go-linereader@1b945b3263eb
go mod tidy
go mod vendor
2019-02-21 08:59:37 +00:00
..
LICENSE.md
README.md
go.mod vendor: github.com/mitchellh/go-linereader@1b945b3263eb 2019-02-21 08:59:37 +00:00
linereader.go

README.md

go-linereader

go-linereader (Golang package: linereader) is a package for Go that breaks up the input from an io.Reader into multiple lines. It is a lot like bufio.Scanner, except you can specify timeouts that will push "lines" through after a certain amount of time. This lets you read lines, but return any data if a line isn't updated for some time.

Installation and Usage

Install using go get github.com/mitchellh/go-linereader.

Full documentation is available at http://godoc.org/github.com/mitchellh/go-linereader

Below is an example of its usage ignoring errors:

// Assume r is some set io.Reader. Perhaps a file, network, anything.
var r io.Reader

// Initialize the line reader
lr := linereader.New(r)

// Get all the lines
for line := <-lr.Ch {
	// Do something with the line. This line will have the line separator
	// removed.
}