Created
May 30, 2024 13:40
-
-
Save jftuga/c96f653b32516425482fc04991cd008b to your computer and use it in GitHub Desktop.
example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"io" | |
"os" | |
) | |
func main() { | |
var count int64 | |
var total int64 | |
var err error | |
for { | |
count, err = io.CopyN(os.Stdout, os.Stdin, 1048576) | |
if err != nil { | |
total += count | |
goto DONE | |
} | |
total += count | |
} | |
DONE: | |
_, _ = fmt.Fprintf(os.Stderr, "%d bytes copied.\n", total) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment