lintMsg is the callback function for lint command
(confPath, msgPath string)
| 21 | |
| 22 | // lintMsg is the callback function for lint command |
| 23 | func lintMsg(confPath, msgPath string) error { |
| 24 | // NOTE: lint should return with exit code for error case |
| 25 | resStr, hasError, err := runLint(confPath, msgPath) |
| 26 | if err != nil { |
| 27 | return cli.Exit(err, errExitCode) |
| 28 | } |
| 29 | |
| 30 | if hasError { |
| 31 | return cli.Exit(resStr, errExitCode) |
| 32 | } |
| 33 | |
| 34 | // print success message |
| 35 | fmt.Println(resStr) |
| 36 | return nil |
| 37 | } |
| 38 | |
| 39 | func runLint(confFilePath, fileInput string) (lintResult string, hasError bool, err error) { |
| 40 | linter, format, err := getLinter(confFilePath) |