aboutsummaryrefslogtreecommitdiffstats
path: root/skate/must
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2021-03-21 01:17:38 +0100
committerMartin Czygan <martin.czygan@gmail.com>2021-03-21 01:17:38 +0100
commit09a7e8c9d013f13a1aa1ef4e9b7f397647b79967 (patch)
tree122b474e27afbc66cba1182e983ef5c8555ed12f /skate/must
parenta7e0cf191ebf8fb499e0ab9a3b6cae45727f1286 (diff)
downloadrefcat-09a7e8c9d013f13a1aa1ef4e9b7f397647b79967.tar.gz
refcat-09a7e8c9d013f13a1aa1ef4e9b7f397647b79967.zip
initial import of skate
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
+}