23 lines
312 B
Go

package main
import (
"fmt"
"io"
"log"
"os"
)
func main() {
if len(os.Args) != 2 {
fmt.Printf("No filename given!\n Usage: %s <filename>\n", os.Args[0])
os.Exit(1)
}
filename := os.Args[1]
file, err := os.Open(filename)
if err != nil {
log.Fatal(err)
os.Exit(1)
}
io.Copy(os.Stdout, file)
}