fix: typos in input scanning

This commit is contained in:
Inanc Gumus
2019-05-06 16:31:25 +03:00
parent 9ee5f8e0ba
commit 604560d4cc
2 changed files with 10 additions and 10 deletions

View File

@ -14,12 +14,12 @@ import (
)
func main() {
// Create a new scanner that scans from the standard-input
in := bufio.NewScanner(os.Stdin)
// Simulate an error
// os.Stdin.Close()
// Create a new scanner that scans from the standard-input
in := bufio.NewScanner(os.Stdin)
// Stores the total number of lines in the input
var lines int
@ -32,10 +32,9 @@ func main() {
// fmt.Println("Scanned Bytes:", in.Bytes())
in.Text()
}
fmt.Printf("There %d lines.\n", lines)
fmt.Printf("There are %d line(s)\n", lines)
err := in.Err()
if err != nil {
if err := in.Err(); err != nil {
fmt.Println("ERROR:", err)
}
}