summaryrefslogtreecommitdiff
path: root/recipe.go
diff options
context:
space:
mode:
Diffstat (limited to 'recipe.go')
-rw-r--r--recipe.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/recipe.go b/recipe.go
index 76c5204..a1a27e9 100644
--- a/recipe.go
+++ b/recipe.go
@@ -22,11 +22,20 @@ type recipe struct {
}
}
+func getRecipeText(id string) ([]byte, error) {
+ var b []byte
+ textpath := filepath.Join(config.Data, "recipes", id, "text")
+ b, err := ioutil.ReadFile(textpath)
+ if err != nil {
+ return b, err
+ }
+ return b, nil
+}
+
func getRecipe(id string) (recipe, error) {
r := recipe{}
- textpath := filepath.Join(config.Data, "recipes", id, "text")
- data, err := ioutil.ReadFile(textpath)
+ data, err := getRecipeText(id)
if err != nil {
return r, err
}