Skip to content

Commit

Permalink
Forgot how bufio.Scanner works
Browse files Browse the repository at this point in the history
  • Loading branch information
susji committed Apr 3, 2024
1 parent 6f8a110 commit 84ff813
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ func main() {
s := bufio.NewScanner(os.Stdin)
fmt.Fprintln(os.Stderr, "reading standard input as", mode)
for s.Scan() {
if err := s.Err(); err != nil {
fmt.Fprintln(os.Stderr, "reading input failed:", err)
continue // Maybe depart?
}
d, err := dec(s.Bytes())
if err != nil {
fmt.Fprintln(os.Stderr, "decoding input failed:", err)
Expand All @@ -60,4 +56,7 @@ func main() {
}
fmt.Println(string(out))
}
if err := s.Err(); err != nil {
fmt.Fprintln(os.Stderr, "reading input failed:", err)
}
}

0 comments on commit 84ff813

Please sign in to comment.