Skip to content

Commit 950b770

Browse files
committed
test: add importShadow test
1 parent 7c37d1f commit 950b770

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//golangcitest:args -Egocritic
2+
//golangcitest:config_path testdata/gocritic_inportShadow.yml
3+
package testdata
4+
5+
import (
6+
"fmt"
7+
"path/filepath"
8+
)
9+
10+
func Bar() {
11+
filepath.Join("a", "b")
12+
}
13+
14+
func foo() {
15+
filepath := "foo.txt" // want "importShadow: shadow of imported package 'filepath'"
16+
fmt.Printf("File path: %s\n", filepath)
17+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: "2"
2+
3+
linters:
4+
settings:
5+
gocritic:
6+
disable-all: true
7+
enabled-checks:
8+
- importShadow

0 commit comments

Comments
 (0)