@@ -5,33 +5,31 @@ import (
5
5
"strings"
6
6
"sync"
7
7
8
+ "github.com/OpenPeeDeeP/depguard"
8
9
"golang.org/x/tools/go/analysis"
9
10
"golang.org/x/tools/go/loader"
10
11
11
12
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
12
-
13
- depguardAPI "github.com/OpenPeeDeeP/depguard"
14
-
15
13
"github.com/golangci/golangci-lint/pkg/lint/linter"
16
14
"github.com/golangci/golangci-lint/pkg/result"
17
15
)
18
16
19
- func setDepguardListType (dg * depguardAPI .Depguard , lintCtx * linter.Context ) error {
17
+ func setDepguardListType (dg * depguard .Depguard , lintCtx * linter.Context ) error {
20
18
listType := lintCtx .Settings ().Depguard .ListType
21
19
var found bool
22
- dg .ListType , found = depguardAPI .StringToListType [strings .ToLower (listType )]
20
+ dg .ListType , found = depguard .StringToListType [strings .ToLower (listType )]
23
21
if ! found {
24
22
if listType != "" {
25
23
return fmt .Errorf ("unsure what list type %s is" , listType )
26
24
}
27
- dg .ListType = depguardAPI .LTBlacklist
25
+ dg .ListType = depguard .LTBlacklist
28
26
}
29
27
30
28
return nil
31
29
}
32
30
33
- func setupDepguardPackages (dg * depguardAPI .Depguard , lintCtx * linter.Context ) {
34
- if dg .ListType == depguardAPI .LTBlacklist {
31
+ func setupDepguardPackages (dg * depguard .Depguard , lintCtx * linter.Context ) {
32
+ if dg .ListType == depguard .LTBlacklist {
35
33
// if the list type was a blacklist the packages with error messages should
36
34
// be included in the blacklist package list
37
35
@@ -66,7 +64,7 @@ func NewDepguard() *goanalysis.Linter {
66
64
dgSettings := & lintCtx .Settings ().Depguard
67
65
analyzer .Run = func (pass * analysis.Pass ) (interface {}, error ) {
68
66
prog := goanalysis .MakeFakeLoaderProgram (pass )
69
- dg := & depguardAPI .Depguard {
67
+ dg := & depguard .Depguard {
70
68
Packages : dgSettings .Packages ,
71
69
IncludeGoRoot : dgSettings .IncludeGoRoot ,
72
70
}
@@ -87,7 +85,7 @@ func NewDepguard() *goanalysis.Linter {
87
85
return nil , nil
88
86
}
89
87
msgSuffix := "is in the blacklist"
90
- if dg .ListType == depguardAPI .LTWhitelist {
88
+ if dg .ListType == depguard .LTWhitelist {
91
89
msgSuffix = "is not in the whitelist"
92
90
}
93
91
res := make ([]result.Issue , 0 , len (issues ))
0 commit comments