flip logic to check for input content, this assists debugging in Goland

This commit is contained in:
Luke Emmet 2020-08-25 23:40:53 +01:00
parent a29cb7bd9a
commit 4fe9d4a03e

View File

@ -56,16 +56,15 @@ func getInput() (string, error) {
info, err := os.Stdin.Stat() info, err := os.Stdin.Stat()
check(err) check(err)
if info.Mode()&os.ModeNamedPipe != 0 { if *input != "" {
//get the input file from the command line
dat, err := ioutil.ReadFile(*input)
check(err)
inputHtml = string(dat)
} else if info.Mode()&os.ModeNamedPipe != 0 {
// we have a pipe input // we have a pipe input
inputHtml = readStdin() inputHtml = readStdin()
} else if *input != "" {
//get the input file from the command line
dat, err := ioutil.ReadFile(*input)
check(err)
inputHtml = string(dat)
} else { } else {
//we shouldn't get here //we shouldn't get here
return "", errors.New("invalid option for input - use -i <path> or pipe to stdin") return "", errors.New("invalid option for input - use -i <path> or pipe to stdin")