package main import ( "io" "io/ioutil" "strings" "os" ) func main() { a := strings.NewReader("123456789") r := io.LimitReader(a, 5) t := io.TeeReader(r, ioutil.Discard) io.ReadAll(t) io.Copy(os.Stdout, a) // 6789 }
package main import ( "io" "io/ioutil" "strings" "os" ) func main() { a := strings.NewReader("123456789") r := io.LimitReader(a, 5) t := io.TeeReader(r, ioutil.Discard) io.ReadAll(t) io.Copy(os.Stdout, a) // 6789 }