forked from microsoft/hcsshim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check in CI that the test/ module doesn't use internal APIs
An idea mentioned in-passing in microsoft#1073, this would ensure that tests can be looked at as usage examples, which use of internal APIs prevents. vendor/ and internal/ are excluded, the former because we only care about direct dependencies, and the latter so that if tests are done that depend on an unpublished API, it's possible _and_ explicit. Signed-off-by: Paul "TBBle" Hampson <[email protected]>
- Loading branch information
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
$FOUND = 0 | ||
Get-ChildItem -Path $args[0] -Recurse -Include '*.go' | Where-Object { $_.Directory -NotMatch 'vendor|internal' } | ForEach-Object { | ||
$LISTDATA = (go list -tags functional -json $_.FullName | ConvertFrom-Json) | ||
$INTERNALS = $LISTDATA.Imports.Where({ $_.StartsWith("github.com/Microsoft/hcsshim/internal") }) + $LISTDATA.TestImports.Where({ $_.StartsWith("github.com/Microsoft/hcsshim/internal") }) | ||
if ($INTERNALS.Length -gt 0) { Write-Output "$_ contains one or more imports from github.com/Microsoft/hcsshim/internal/..."; $FOUND += 1 } | ||
} | ||
exit $FOUND |