Skip to content

Commit

Permalink
Added nested dir
Browse files Browse the repository at this point in the history
  • Loading branch information
nametake committed Jan 13, 2025
1 parent 4fc9cad commit 0de8002
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
28 changes: 28 additions & 0 deletions handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,34 @@ func TestLangHandler_lint_Integration(t *testing.T) {
},
},
},
{
name: "nested directories in rootDir",
h: &langHandler{
logger: newStdLogger(false),
command: []string{"golangci-lint", "run", "--out-format", "json", "--issues-exit-code=1"},
rootDir: filepath.Dir("./testdata/nesteddir"),
},
filePath: "./testdata/nesteddir/bar/bar.go",
want: []Diagnostic{
{
Range: Range{
Start: Position{
Line: 3,
Character: 4,
},
End: Position{
Line: 3,
Character: 4,
},
},
Severity: DSWarning,
Code: nil,
Source: pt("unused"),
Message: "unused: var `bar` is unused",
RelatedInformation: nil,
},
},
},
}

for _, tt := range tests {
Expand Down
4 changes: 4 additions & 0 deletions testdata/nesteddir/bar/bar.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package bar

// unused: var `bar` is unused
var bar = "bar"
4 changes: 4 additions & 0 deletions testdata/nesteddir/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package main

// unused: var `foo` is unused
var foo = "foo"

0 comments on commit 0de8002

Please # to comment.