Skip to content

Commit

Permalink
fix readLines() func
Browse files Browse the repository at this point in the history
  • Loading branch information
whonion committed Jun 21, 2023
1 parent 924364a commit 04a9ce5
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions go-routine.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@ import (
"time"
)

func readLines(filename string) ([]string, error) {
file, err := os.Open(filename)
if err != nil {
return nil, err
}
defer file.Close()

var lines []string
scanner := bufio.NewScanner(file)
for scanner.Scan() {
lines = append(lines, scanner.Text())
}
return lines, scanner.Err()
}
func main() {
addresses, err := readLines("addresses.txt")
if err != nil {
Expand Down Expand Up @@ -87,18 +101,3 @@ func main() {
}
wg.Wait()
}

func readLines(filename string) ([]string, error) {
file, err := os.Open(filename)
if err != nil {
return nil, err
}
defer file.Close()

var lines []string
scanner := bufio.NewScanner(file)
for scanner.Scan() {
lines = append(lines, scanner.Text())
}
return lines, scanner.Err()
}

0 comments on commit 04a9ce5

Please sign in to comment.