From 7bb54a56e993723b2867efbafddd1b9abfebcd9e Mon Sep 17 00:00:00 2001 From: xengineering Date: Sat, 22 Apr 2023 19:28:54 +0200 Subject: Remove legacy Recipe struct --- recipe.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'recipe.go') 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 } -- cgit v1.2.3-70-g09d2