Skip to content

Commit 24bb81a

Browse files
authoredFeb 27, 2025
Merge pull request #3934 from apostasie/ci-remove-isolation-hack
Enforce pkg isolation as part of golangci
2 parents 1fd291f + 715cb0c commit 24bb81a

File tree

3 files changed

+17
-28
lines changed

3 files changed

+17
-28
lines changed
 

‎.github/workflows/project.yml

-2
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,3 @@ jobs:
3030
repo-access-token: ${{ secrets.GITHUB_TOKEN }}
3131
- run: ./hack/verify-no-patent.sh
3232
working-directory: src/github.com/containerd/nerdctl
33-
- run: ./hack/verify-pkg-isolation.sh
34-
working-directory: src/github.com/containerd/nerdctl

‎.golangci.yml

+17-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ run:
55
linters:
66
disable-all: true
77
enable:
8-
# - depguard
8+
- depguard
99
- gofmt
1010
- goimports
1111
- govet
@@ -135,6 +135,22 @@ linters-settings:
135135
- unnamedResult
136136
- unnecessaryBlock
137137

138+
depguard:
139+
rules:
140+
# pkg files must not depend on cobra nor anything in cmd
141+
pkg:
142+
files:
143+
- "**/pkg/**/*.go"
144+
deny:
145+
- pkg: "github.com/spf13/cobra"
146+
desc: "pkg must not depend on cobra"
147+
- pkg: "github.com/spf13/pflag"
148+
desc: "pkg must not depend on pflag"
149+
- pkg: "github.com/spf13/viper"
150+
desc: "pkg must not depend on viper"
151+
- pkg: "github.com/containerd/nerdctl/v2/cmd"
152+
desc: "pkg must not depend on any cmd files"
153+
138154
issues:
139155
max-issues-per-linter: 0
140156
max-same-issues: 0

‎hack/verify-pkg-isolation.sh

-25
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.