2015-07-20 21:32:55 -04:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
source "${MAKEDIR}/.validate"
|
|
|
|
|
|
|
|
# We will eventually get to the point when packages should be the complete list
|
|
|
|
# of subpackages, vendoring excluded, as given by:
|
2015-07-21 17:54:27 -04:00
|
|
|
#
|
|
|
|
# packages=( $(go list ./... 2> /dev/null | grep -vE "^github.com/docker/docker/vendor" || true ) )
|
|
|
|
|
2015-07-20 21:32:55 -04:00
|
|
|
packages=(
|
2015-07-22 11:46:42 -04:00
|
|
|
builder
|
|
|
|
builder/command
|
|
|
|
builder/parser
|
2015-07-20 21:32:55 -04:00
|
|
|
builder/parser/dumper
|
|
|
|
daemon/events
|
|
|
|
daemon/execdriver/native/template
|
|
|
|
daemon/network
|
|
|
|
docker
|
|
|
|
dockerinit
|
2015-07-22 08:59:24 -04:00
|
|
|
integration-cli
|
2015-07-20 21:32:55 -04:00
|
|
|
pkg/chrootarchive
|
|
|
|
pkg/directory
|
|
|
|
pkg/fileutils
|
|
|
|
pkg/homedir
|
|
|
|
pkg/listenbuffer
|
|
|
|
pkg/mflag/example
|
2015-07-21 13:49:42 -04:00
|
|
|
pkg/mount
|
2015-07-21 17:54:27 -04:00
|
|
|
pkg/namesgenerator
|
2015-07-22 11:46:42 -04:00
|
|
|
pkg/nat
|
2015-07-20 21:32:55 -04:00
|
|
|
pkg/promise
|
|
|
|
pkg/pubsub
|
|
|
|
pkg/random
|
2015-07-21 17:54:27 -04:00
|
|
|
pkg/reexec
|
2015-07-20 21:32:55 -04:00
|
|
|
pkg/symlink
|
|
|
|
pkg/timeutils
|
|
|
|
pkg/tlsconfig
|
|
|
|
pkg/urlutil
|
|
|
|
pkg/version
|
2015-07-21 17:54:27 -04:00
|
|
|
utils
|
2015-07-20 21:32:55 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
errors=()
|
2015-07-21 17:54:27 -04:00
|
|
|
for p in "${packages[@]}"; do
|
2015-07-22 13:11:00 -04:00
|
|
|
# Run golint on package/*.go file explicitly to validate all go files
|
|
|
|
# and not just the ones for the current platform.
|
|
|
|
failedLint=$(golint "$p"/*.go)
|
2015-07-20 21:32:55 -04:00
|
|
|
if [ "$failedLint" ]; then
|
2015-07-21 17:54:27 -04:00
|
|
|
errors+=( "$failedLint" )
|
2015-07-20 21:32:55 -04:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ ${#errors[@]} -eq 0 ]; then
|
|
|
|
echo 'Congratulations! All Go source files have been linted.'
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "Errors from golint:"
|
2015-07-21 17:54:27 -04:00
|
|
|
for err in "${errors[@]}"; do
|
|
|
|
echo "$err"
|
|
|
|
done
|
2015-07-20 21:32:55 -04:00
|
|
|
echo
|
|
|
|
echo 'Please fix the above errors. You can test via "golint" and commit the result.'
|
|
|
|
echo
|
|
|
|
} >&2
|
|
|
|
false
|
|
|
|
fi
|