| 169 | } |
| 170 | |
| 171 | func readStdInPipe() (string, error) { |
| 172 | stat, err := os.Stdin.Stat() |
| 173 | if err != nil { |
| 174 | return "", err |
| 175 | } |
| 176 | |
| 177 | // user input from terminal |
| 178 | if (stat.Mode() & os.ModeCharDevice) != 0 { |
| 179 | // not handling this case |
| 180 | return "", nil |
| 181 | } |
| 182 | |
| 183 | // user input from stdin pipe |
| 184 | readBytes, err := io.ReadAll(os.Stdin) |
| 185 | if err != nil { |
| 186 | return "", err |
| 187 | } |
| 188 | s := string(readBytes) |
| 189 | return strings.TrimSpace(s), nil |
| 190 | } |
| 191 | |
| 192 | func hasErrorSeverity(result *lint.Result) bool { |
| 193 | for _, i := range result.Issues() { |