| 1 | package plist |
| 2 | |
| 3 | import ( |
| 4 | "io" |
| 5 | "strconv" |
| 6 | ) |
| 7 | |
| 8 | type mustWriter struct { |
| 9 | io.Writer |
| 10 | } |
| 11 | |
| 12 | func (w mustWriter) Write(p []byte) (int, error) { |
| 13 | n, err := w.Writer.Write(p) |
| 14 | if err != nil { |
| 15 | panic(err) |
| 16 | } |
| 17 | return n, nil |
| 18 | } |
| 19 | |
| 20 | func mustParseInt(str string, base, bits int) int64 { |
| 21 | i, err := strconv.ParseInt(str, base, bits) |
| 22 | if err != nil { |
| 23 | panic(err) |
| 24 | } |
| 25 | return i |
| 26 | } |
| 27 | |
| 28 | func mustParseUint(str string, base, bits int) uint64 { |
| 29 | i, err := strconv.ParseUint(str, base, bits) |
| 30 | if err != nil { |
| 31 | panic(err) |
| 32 | } |
| 33 | return i |
| 34 | } |
| 35 | |
| 36 | func mustParseFloat(str string, bits int) float64 { |
| 37 | i, err := strconv.ParseFloat(str, bits) |
| 38 | if err != nil { |
| 39 | panic(err) |
| 40 | } |
| 41 | return i |
| 42 | } |
| 43 | |
| 44 | func mustParseBool(str string) bool { |
| 45 | i, err := strconv.ParseBool(str) |
| 46 | if err != nil { |
| 47 | panic(err) |
| 48 | } |
| 49 | return i |
| 50 | } |