croak.go 243 B

123456789101112131415161718
  1. package missinggo
  2. import (
  3. "fmt"
  4. "os"
  5. )
  6. func Unchomp(s string) string {
  7. if len(s) > 0 && s[len(s)-1] == '\n' {
  8. return s
  9. }
  10. return s + "\n"
  11. }
  12. func Fatal(msg interface{}) {
  13. os.Stderr.WriteString(Unchomp(fmt.Sprint(msg)))
  14. os.Exit(1)
  15. }