Unix pipes in Go
We first talked about pipes in Chapter 6,File Input and Output. Pipes have two serious limitations: first, they usually communicate in one direction, and second, they can only be used between processes that have a common ancestor.
The general idea behind pipes is that if you do not have a file to process, you should wait to get your input from standard input. Similarly, if you are not told to save your output to a file, you should write your output to standard output, either for the user to see it or for another program to process it. As a result, pipes can be used for streaming data between two processes without creating any temporary files.
This section will present some simple utilities written in Go that use Unix pipes for clarity.
Reading from standard input
The first thing that you need to know in order to develop Go applications that support Unix pipes is how to read from standard input.
The developed program is named readSTDIN.go
and will be presented in three parts.
The...