feat(d-eyes): init
This commit is contained in:
29
process/utils/readfile.go
Normal file
29
process/utils/readfile.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func ReadLindIp(fileName string) ([]string, error) {
|
||||
f, err := os.Open(fileName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
buf := bufio.NewScanner(f)
|
||||
var result []string
|
||||
|
||||
for {
|
||||
if !buf.Scan() {
|
||||
break
|
||||
}
|
||||
|
||||
line := buf.Text()
|
||||
line = strings.TrimSpace(line)
|
||||
|
||||
result = append(result, line)
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
Reference in New Issue
Block a user