diff options
| author | Paul Buetow <paul@buetow.org> | 2024-10-31 22:27:25 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2024-10-31 22:27:25 +0200 |
| commit | 177979b5df6336e477d5aa3cdc64b3021288bb92 (patch) | |
| tree | 9b4c146b1413bf99b2fc6ec4fc58a7ab77c9cc03 /internal/oi | |
| parent | 368d58e61ab3f9978c7cf51ee4c0d45263b9e5c5 (diff) | |
refactor
Diffstat (limited to 'internal/oi')
| -rw-r--r-- | internal/oi/oi.go | 9 |
1 files changed, 9 insertions, 0 deletions
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 +} |
