I have an implementation of the Unix cat tool below. It reads a few bytes from os.Stdin into the buffer, and then writes these bytes to os.Stdout . Is there a way in which I can skip the buffer and just connect Stdin to Stdout ?
package main import "os" import "io" func main() { buf := make([]byte, 1024) var n int var err error for err != io.EOF { n, err = os.Stdin.Read(buf) if n > 0 { os.Stdout.Write(buf[0:n]) } } }
source share