File tree Expand file tree Collapse file tree 7 files changed +42
-52
lines changed Expand file tree Collapse file tree 7 files changed +42
-52
lines changed Original file line number Diff line number Diff line change @@ -26,13 +26,3 @@ require (
2626 google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5 // indirect
2727 gopkg.in/yaml.v3 v3.0.1 // indirect
2828)
29-
30- // Bad imports are sometimes causing attempts to pull that code.
31- // This makes the error more explicit.
32- replace (
33- go.etcd.io/etcd => ./FORBIDDEN_DEPENDENCY
34- go.etcd.io/etcd/api/v3 => ./FORBIDDEN_DEPENDENCY
35- go.etcd.io/etcd/pkg/v3 => ./FORBIDDEN_DEPENDENCY
36- go.etcd.io/etcd/tests/v3 => ./FORBIDDEN_DEPENDENCY
37- go.etcd.io/etcd/v3 => ./FORBIDDEN_DEPENDENCY
38- )
Original file line number Diff line number Diff line change @@ -46,12 +46,3 @@ replace (
4646 go.etcd.io/etcd/api/v3 => ../../api
4747 go.etcd.io/etcd/client/pkg/v3 => ../pkg
4848)
49-
50- // Bad imports are sometimes causing attempts to pull that code.
51- // This makes the error more explicit.
52- replace (
53- go.etcd.io/etcd => ./FORBIDDEN_DEPENDENCY
54- go.etcd.io/etcd/pkg/v3 => ./FORBIDDEN_DEPENDENCY
55- go.etcd.io/etcd/v3 => ./FORBIDDEN_DEPENDENCY
56- go.etcd.io/tests/v3 => ./FORBIDDEN_DEPENDENCY
57- )
Original file line number Diff line number Diff line change @@ -54,11 +54,3 @@ replace (
5454 go.etcd.io/etcd/client/v3 => ../client/v3
5555 go.etcd.io/etcd/pkg/v3 => ../pkg
5656)
57-
58- // Bad imports are sometimes causing attempts to pull that code.
59- // This makes the error more explicit.
60- replace (
61- go.etcd.io/etcd => ./FORBIDDEN_DEPENDENCY
62- go.etcd.io/etcd/v3 => ./FORBIDDEN_DEPENDENCY
63- go.etcd.io/tests/v3 => ./FORBIDDEN_DEPENDENCY
64- )
Original file line number Diff line number Diff line change @@ -12,14 +12,6 @@ replace (
1212 go.etcd.io/etcd/server/v3 => ../server
1313)
1414
15- // Bad imports are sometimes causing attempts to pull that code.
16- // This makes the error more explicit.
17- replace (
18- go.etcd.io/etcd => ./FORBIDDEN_DEPENDENCY
19- go.etcd.io/etcd/v3 => ./FORBIDDEN_DEPENDENCY
20- go.etcd.io/tests/v3 => ./FORBIDDEN_DEPENDENCY
21- )
22-
2315require (
2416 github.com/coreos/go-semver v0.3.1
2517 github.com/dustin/go-humanize v1.0.1
Original file line number Diff line number Diff line change @@ -32,14 +32,3 @@ require (
3232)
3333
3434replace go.etcd.io/etcd/client/pkg/v3 => ../client/pkg
35-
36- // Bad imports are sometimes causing attempts to pull that code.
37- // This makes the error more explicit.
38- // Etcd contains lots of packages and dependency relationship.
39- // Shouldn't import unnecessary dependencies
40- replace (
41- go.etcd.io/etcd => ./FORBIDDEN_DEPENDENCY
42- go.etcd.io/etcd/api/v3 => ./FORBIDDEN_DEPENDENCY
43- go.etcd.io/etcd/tests/v3 => ./FORBIDDEN_DEPENDENCY
44- go.etcd.io/etcd/v3 => ./FORBIDDEN_DEPENDENCY
45- )
Original file line number Diff line number Diff line change @@ -82,9 +82,3 @@ replace (
8282 go.etcd.io/etcd/client/v3 => ../client/v3
8383 go.etcd.io/etcd/pkg/v3 => ../pkg
8484)
85-
86- // Bad imports are sometimes causing attempts to pull that code.
87- // This makes the error more explicit.
88- replace go.etcd.io/etcd => ./FORBIDDEN_DEPENDENCY
89-
90- replace go.etcd.io/tests/v3 => ./FORBIDDEN_DEPENDENCY
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ version: "2"
33linters :
44 default : none
55 enable : # please keep this alphabetized
6+ - depguard # Implement forbidden dependencies
67 - errorlint
78 - ineffassign
89 - nakedret
@@ -17,6 +18,47 @@ linters:
1718 - usetesting
1819 - whitespace
1920 settings :
21+ depguard :
22+ rules :
23+ api :
24+ list-mode : lax
25+ files :
26+ - ' **/api/**/*.go'
27+ - ' !**/server/etcdserver/api/**/*.go'
28+ deny :
29+ - pkg : go.etcd.io/etcd/api/v3$
30+ - pkg : go.etcd.io/etcd/pkg/v3
31+ - pkg : go.etcd.io/etcd/v3
32+ - pkg : go.etcd.io/tests/v3
33+ - pkg : go.etcd.io/v3
34+ client :
35+ list-mode : lax
36+ files :
37+ - " **/client/v3/**/*.go"
38+ deny :
39+ - pkg : go.etcd.io/etcd/pkg/v3
40+ - pkg : go.etcd.io/etcd/v3
41+ - pkg : go.etcd.io/tests/v3
42+ cli-and-server :
43+ list-mode : lax
44+ files :
45+ - " **/etcdctl/**/*.go"
46+ - " **/etcdutl/**/*.go"
47+ - " **/server/**/*.go"
48+ - " !**/tests/antithesis/server/**/*.go"
49+ deny :
50+ - pkg : go.etcd.io/etcd/v3
51+ - pkg : go.etcd.io/tests/v3
52+ pkg :
53+ list-mode : lax
54+ files :
55+ - " **/pkg/**/*.go"
56+ - " !**/client/pkg/**/*.go"
57+ - " !**/tools/rw-heatmaps/pkg/**/*.go"
58+ deny :
59+ - pkg : go.etcd.io/etcd/api/v3
60+ - pkg : go.etcd.io/etcd/v3
61+ - pkg : go.etcd.io/tests/v3
2062 nakedret :
2163 # Align with https://github.com/alexkohler/nakedret/blob/v1.0.2/cmd/nakedret/main.go#L10
2264 max-func-lines : 5
You can’t perform that action at this time.
0 commit comments