We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 702d2d8 commit 6f10061Copy full SHA for 6f10061
1 file changed
input.go
@@ -8,12 +8,13 @@ import (
8
)
9
10
func readInput() (input []byte, err error) {
11
- if stdinStat, _ := os.Stdin.Stat(); (stdinStat.Mode() & os.ModeCharDevice) == 0 {
12
- if input, err = ioutil.ReadAll(os.Stdin); err != nil {
+
+ if len(os.Args) > 1 {
13
+ if input, err = ioutil.ReadFile(os.Args[1]); err != nil {
14
log.Fatalln(err)
15
}
- } else if len(os.Args) > 1 {
16
- if input, err = ioutil.ReadFile(os.Args[1]); err != nil {
+ } else if stdinStat, _ := os.Stdin.Stat(); (stdinStat.Mode() & os.ModeCharDevice) == 0 {
17
+ if input, err = ioutil.ReadAll(os.Stdin); err != nil {
18
19
20
} else {
0 commit comments