diff options
Diffstat (limited to 'utils/other_utils.go')
| -rw-r--r-- | utils/other_utils.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/utils/other_utils.go b/utils/other_utils.go index d0b360e..13c6c15 100644 --- a/utils/other_utils.go +++ b/utils/other_utils.go @@ -29,3 +29,21 @@ func RetrieveLines(pool chan string, filename string) { } close(pool) } + +func RetrieveLinesToSlice(filename string) []string { + results := []string{} + f, err := os.Open(filename) + if err != nil { + panic(err) + } + reader := bufio.NewReader(f) + for { + s, err := reader.ReadString('\n') + if err == io.EOF { + break + } + s = strings.Trim(s, "\n") + results = append(results, s) + } + return results +} |
