From 177979b5df6336e477d5aa3cdc64b3021288bb92 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 31 Oct 2024 22:27:25 +0200 Subject: refactor --- internal/oi/oi.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'internal/oi') diff --git a/internal/oi/oi.go b/internal/oi/oi.go index 8ee29d5..b2a0953 100644 --- a/internal/oi/oi.go +++ b/internal/oi/oi.go @@ -6,6 +6,7 @@ import ( "io" "os" "path/filepath" + "strings" "time" "golang.org/x/exp/rand" @@ -138,3 +139,11 @@ func Rename(srcPath, dstPath string) error { } return os.Rename(srcPath, dstPath) } + +func SlurpAndTrim(filePath string) (string, error) { + bytes, err := os.ReadFile(filePath) + if err != nil { + return "", err + } + return strings.TrimSpace(string(bytes)), nil +} -- cgit v1.2.3