aboutsummaryrefslogtreecommitdiffstats
path: root/skate/must
diff options
context:
space:
mode:
Diffstat (limited to 'skate/must')
-rw-r--r--skate/must/file.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/skate/must/file.go b/skate/must/file.go
new file mode 100644
index 0000000..3c5a355
--- /dev/null
+++ b/skate/must/file.go
@@ -0,0 +1,24 @@
+package must
+
+import (
+ "io/ioutil"
+ "os"
+)
+
+// Open opens a file or panics.
+func Open(filename string) *os.File {
+ f, err := os.Open(filename)
+ if err != nil {
+ panic(err)
+ }
+ return f
+}
+
+// ReadFile reads a file or panics.
+func ReadFile(filename string) []byte {
+ b, err := ioutil.ReadFile(filename)
+ if err != nil {
+ panic(err)
+ }
+ return b
+}