-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
22 bug creating a machine is weird if user tries to put spaces in the…
… name (#23) * add comment explaining issue * use bufio scanner instead of fmt.scanln
- Loading branch information
1 parent
fe37cef
commit cd95899
Showing
5 changed files
with
36 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package utils | ||
|
||
import ( | ||
"bufio" | ||
"os" | ||
) | ||
|
||
func ReadLineFromStdin(reader *bufio.Scanner, input *string) error { | ||
if reader == nil { | ||
reader = bufio.NewScanner(os.Stdin) | ||
} | ||
if reader.Scan() { | ||
*input = reader.Text() | ||
return nil | ||
} | ||
return reader.Err() | ||
} |