#!/bin/bash source "${MAKEDIR}/.validate" packages=( $(go list ./... 2> /dev/null | grep -vE "^github.com/docker/docker/vendor|^github.com/docker/docker/autogen" || true ) ) errors=() for p in "${packages[@]}"; do # Remove the github.com/docker/docker/ prefix from listed package package="${p#github.com/docker/docker/}" # Run golint on package/*.go file explicitly to validate all go files # and not just the ones for the current platform. failedLint=$(golint $package/*.go) if [ "$failedLint" ]; then errors+=( "$failedLint" ) fi done if [ ${#errors[@]} -eq 0 ]; then echo 'Congratulations! All Go source files have been linted.' else { echo "Errors from golint:" for err in "${errors[@]}"; do echo "$err" done echo echo 'Please fix the above errors. You can test via "golint" and commit the result.' echo } >&2 false fi