Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "io"
- "log"
- "os"
- )
- func main() {
- if len(os.Args) > 1 && os.Args[1] != "-" {
- output(os.ReadFile(os.Args[1]))
- } else {
- output(io.ReadAll(os.Stdin))
- }
- }
- func output(b []byte, err error) {
- if err != nil {
- log.Fatalf("unable to read file %s: %v", os.Args[0], err)
- }
- println(string(b))
- }
Add Comment
Please, Sign In to add comment