github.com/docker/compose-on-kubernetes@v0.5.0/scripts/validate-pkg (about) 1 #!/usr/bin/env bash 2 set -e 3 4 badFiles=() 5 for f in $(find ./api -iname '*.go'); do 6 IFS=$'\n' 7 badImports=( $(go list -e -f '{{ join .Deps "\n" }}' "$f" | sort -u | grep -vE '^github.com/docker/compose-on-kubernetes/api/' | grep -vE '^github.com/docker/compose-on-kubernetes/vendor' | grep -E '^github.com/docker/compose-on-kubernetes' || true) ) 8 unset IFS 9 10 for import in "${badImports[@]}"; do 11 badFiles+=( "$f imports $import" ) 12 done 13 done 14 15 if [ ${#badFiles[@]} -eq 0 ]; then 16 echo 'Congratulations! "./api/..." is safely isolated from internal code.' 17 else 18 { 19 echo 'These files import internal code: (either directly or indirectly)' 20 for f in "${badFiles[@]}"; do 21 echo " - $f" 22 done 23 echo 24 } >&2 25 false 26 fi