We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 812ee6f commit 8a030b4Copy full SHA for 8a030b4
1 file changed
hostsfile/hostsfile.go
@@ -36,15 +36,13 @@ func Parse(p string) (map[string][]string, error) {
36
return nil, errors.New("hosts file doesn't exist")
37
}
38
39
- hostsFileCh, err := fileutil.ReadFile(p)
40
- if err != nil {
41
- return nil, err
42
- }
43
-
44
items := make(map[string][]string)
45
lineCount := 0
46
47
- for line := range hostsFileCh {
+ for line, err := range fileutil.Lines(p) {
+ if err != nil {
+ return nil, err
+ }
48
lineCount++
49
if lineCount > MaxLines {
50
break
0 commit comments