blob: 76df5f42e6e02bdd8354e33d3f7931572452a5e4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
package main
import (
"bufio"
"os"
)
func readWordlist(wordlistPath string) ([]string, error) {
file, err := os.Open(wordlistPath)
if err != nil {
return nil, err
}
defer file.Close()
scanner := bufio.NewScanner(file)
scanner.Split(bufio.ScanLines)
var lines []string
for scanner.Scan() {
lines = append(lines, scanner.Text())
}
// return the lines, the line count and no error
return lines, nil
}
|