![Nathan Zadoks](/assets/img/avatar_default.png)
Nearly all Go code on this earth is formatted with gofmt, and it's somewhat surprising to find a Go file that isn't formatted accordingly.
25 lines
317 B
Go
25 lines
317 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"io"
|
|
"io/ioutil"
|
|
"os"
|
|
"tarsum"
|
|
)
|
|
|
|
func main() {
|
|
ts, err := tarsum.NewTarSum(os.Stdin, false, tarsum.Version1)
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
os.Exit(1)
|
|
}
|
|
|
|
if _, err = io.Copy(ioutil.Discard, ts); err != nil {
|
|
fmt.Println(err)
|
|
os.Exit(1)
|
|
}
|
|
|
|
fmt.Println(ts.Sum(nil))
|
|
}
|