Merge pull request #44296 from corhere/narrow-pkg-imports-validator

hack: allow pkg/ to import internal/ packages
This commit is contained in:
Cory Snider 2022-10-14 12:30:57 -04:00 committed by GitHub
commit 40429857c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -263,6 +263,7 @@ Function Validate-PkgImports($headCommit, $upstreamCommit) {
# Filter out what we are looking for
$imports = @() + $imports -NotMatch "^github.com/docker/docker/pkg/" `
-NotMatch "^github.com/docker/docker/vendor" `
-NotMatch "^github.com/docker/docker/internal" `
-Match "^github.com/docker/docker" `
-Replace "`n", ""
$imports | ForEach-Object{ $badFiles+="$file imports $_`n" }

View file

@ -11,7 +11,12 @@ unset IFS
badFiles=()
for f in "${files[@]}"; do
IFS=$'\n'
badImports=($(go list -e -f '{{ join .Deps "\n" }}' "$f" | sort -u | grep -vE '^github.com/docker/docker/pkg/' | grep -vE '^github.com/docker/docker/vendor' | grep -E '^github.com/docker/docker' || true))
badImports=($(go list -e -f '{{ join .Deps "\n" }}' "$f" | sort -u \
| grep -vE '^github.com/docker/docker/pkg/' \
| grep -vE '^github.com/docker/docker/vendor' \
| grep -vE '^github.com/docker/docker/internal' \
| grep -E '^github.com/docker/docker' \
|| true))
unset IFS
for import in "${badImports[@]}"; do