diff options
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 +} |
