Skip to content

Commit 9ac5106

Browse files
committed
fixing tests
1 parent a0a04c8 commit 9ac5106

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

handler_test.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ func TestLangHandler_lint_Integration(t *testing.T) {
1717
t.Fatal("golangci-lint is not installed in this environment")
1818
}
1919

20+
command := []string{"golangci-lint", "run", "--output.json.path", "stdout", "--issues-exit-code=1", "--show-stats=false"}
21+
2022
tests := []struct {
2123
name string
2224
h *langHandler
@@ -27,7 +29,7 @@ func TestLangHandler_lint_Integration(t *testing.T) {
2729
name: "no config file",
2830
h: &langHandler{
2931
logger: newStdLogger(false),
30-
command: []string{"golangci-lint", "run", "--out-format", "json", "--issues-exit-code=1"},
32+
command: command,
3133
rootDir: filepath.Dir("./testdata/noconfig"),
3234
},
3335
filePath: "./testdata/noconfig/main.go",
@@ -46,7 +48,7 @@ func TestLangHandler_lint_Integration(t *testing.T) {
4648
Severity: DSWarning,
4749
Code: nil,
4850
Source: pt("unused"),
49-
Message: "unused: var `foo` is unused",
51+
Message: "unused: var foo is unused",
5052
RelatedInformation: nil,
5153
},
5254
},
@@ -55,7 +57,7 @@ func TestLangHandler_lint_Integration(t *testing.T) {
5557
name: "nolintername option works as expected",
5658
h: &langHandler{
5759
logger: newStdLogger(false),
58-
command: []string{"golangci-lint", "run", "--out-format", "json", "--issues-exit-code=1"},
60+
command: command,
5961
rootDir: filepath.Dir("./testdata/nolintername"),
6062
noLinterName: true,
6163
},
@@ -75,7 +77,7 @@ func TestLangHandler_lint_Integration(t *testing.T) {
7577
Severity: DSWarning,
7678
Code: nil,
7779
Source: pt("unused"),
78-
Message: "var `foo` is unused",
80+
Message: "var foo is unused",
7981
RelatedInformation: nil,
8082
},
8183
},
@@ -84,7 +86,7 @@ func TestLangHandler_lint_Integration(t *testing.T) {
8486
name: "config file is loaded successfully",
8587
h: &langHandler{
8688
logger: newStdLogger(false),
87-
command: []string{"golangci-lint", "run", "--out-format", "json", "--issues-exit-code=1"},
89+
command: command,
8890
rootDir: filepath.Dir("./testdata/nolintername"),
8991
},
9092
filePath: "./testdata/loadconfig/main.go",
@@ -112,7 +114,7 @@ func TestLangHandler_lint_Integration(t *testing.T) {
112114
name: "multiple files in rootDir",
113115
h: &langHandler{
114116
logger: newStdLogger(false),
115-
command: []string{"golangci-lint", "run", "--out-format", "json", "--issues-exit-code=1"},
117+
command: command,
116118
rootDir: filepath.Dir("./testdata/multifile"),
117119
},
118120
filePath: "./testdata/multifile/bar.go",
@@ -131,7 +133,7 @@ func TestLangHandler_lint_Integration(t *testing.T) {
131133
Severity: DSWarning,
132134
Code: nil,
133135
Source: pt("unused"),
134-
Message: "unused: var `bar` is unused",
136+
Message: "unused: var bar is unused",
135137
RelatedInformation: nil,
136138
},
137139
},
@@ -140,7 +142,7 @@ func TestLangHandler_lint_Integration(t *testing.T) {
140142
name: "nested directories in rootDir",
141143
h: &langHandler{
142144
logger: newStdLogger(false),
143-
command: []string{"golangci-lint", "run", "--out-format", "json", "--issues-exit-code=1"},
145+
command: command,
144146
rootDir: filepath.Dir("./testdata/nesteddir"),
145147
},
146148
filePath: "./testdata/nesteddir/bar/bar.go",
@@ -159,7 +161,7 @@ func TestLangHandler_lint_Integration(t *testing.T) {
159161
Severity: DSWarning,
160162
Code: nil,
161163
Source: pt("unused"),
162-
Message: "unused: var `bar` is unused",
164+
Message: "unused: var bar is unused",
163165
RelatedInformation: nil,
164166
},
165167
},

0 commit comments

Comments
 (0)