Skip to content

Commit c917fe2

Browse files
authored
Merge pull request #55 from maxekman/ignore-error-code-for-empty-directory
fix: ignore 'no go files to analyze' error for emtpy folders
2 parents f635d1a + 95988f0 commit c917fe2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

handler.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,17 @@ type langHandler struct {
3333
rootDir string
3434
}
3535

36+
// As defined in the `golangci-lint` source code:
37+
// https://github.com/golangci/golangci-lint/blob/main/pkg/exitcodes/exitcodes.go#L24
38+
const GoNoFilesExitCode = 5
39+
3640
func (h *langHandler) errToDiagnostics(err error) []Diagnostic {
3741
var message string
3842
switch e := err.(type) {
3943
case *exec.ExitError:
44+
if e.ExitCode() == GoNoFilesExitCode {
45+
return []Diagnostic{}
46+
}
4047
message = string(e.Stderr)
4148
default:
4249
h.logger.DebugJSON("golangci-lint-langserver: errToDiagnostics message", message)

0 commit comments

Comments
 (0)