mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Adds validate-vet script
resolves #11970 Signed-off-by: bobby abbott <ttobbaybbob@gmail.com>
This commit is contained in:
parent
82256c2a54
commit
3280ce651b
4 changed files with 28 additions and 1 deletions
|
@ -105,6 +105,10 @@ RUN curl -sSL https://storage.googleapis.com/golang/go${GOFMT_VERSION}.$(go env
|
||||||
# Grab Go's cover tool for dead-simple code coverage testing
|
# Grab Go's cover tool for dead-simple code coverage testing
|
||||||
RUN go get golang.org/x/tools/cmd/cover
|
RUN go get golang.org/x/tools/cmd/cover
|
||||||
|
|
||||||
|
# Grab Go's vet tool for examining go code to find suspicious constructs
|
||||||
|
# and help prevent errors that the compiler might not catch
|
||||||
|
RUN go get golang.org/x/tools/cmd/vet
|
||||||
|
|
||||||
# TODO replace FPM with some very minimal debhelper stuff
|
# TODO replace FPM with some very minimal debhelper stuff
|
||||||
RUN gem install --no-rdoc --no-ri fpm --version 1.3.2
|
RUN gem install --no-rdoc --no-ri fpm --version 1.3.2
|
||||||
|
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -77,7 +77,7 @@ test-docker-py: build
|
||||||
$(DOCKER_RUN_DOCKER) hack/make.sh binary test-docker-py
|
$(DOCKER_RUN_DOCKER) hack/make.sh binary test-docker-py
|
||||||
|
|
||||||
validate: build
|
validate: build
|
||||||
$(DOCKER_RUN_DOCKER) hack/make.sh validate-gofmt validate-dco validate-toml
|
$(DOCKER_RUN_DOCKER) hack/make.sh validate-dco validate-gofmt validate-toml validate-vet
|
||||||
|
|
||||||
shell: build
|
shell: build
|
||||||
$(DOCKER_RUN_DOCKER) bash
|
$(DOCKER_RUN_DOCKER) bash
|
||||||
|
|
|
@ -45,6 +45,7 @@ DEFAULT_BUNDLES=(
|
||||||
validate-dco
|
validate-dco
|
||||||
validate-gofmt
|
validate-gofmt
|
||||||
validate-toml
|
validate-toml
|
||||||
|
validate-vet
|
||||||
|
|
||||||
binary
|
binary
|
||||||
|
|
||||||
|
|
22
hack/make/validate-vet
Normal file
22
hack/make/validate-vet
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source "$(dirname "$BASH_SOURCE")/.validate"
|
||||||
|
|
||||||
|
IFS=$'\n'
|
||||||
|
files=( $(validate_diff --diff-filter=ACMR --name-only -- '*.go' | grep -v '^vendor/' || true) )
|
||||||
|
unset IFS
|
||||||
|
|
||||||
|
for f in "${files[@]}"; do
|
||||||
|
# we use "git show" here to validate that what's committed is vetted
|
||||||
|
failedVet=$(git show "$VALIDATE_HEAD:$f" | go vet)
|
||||||
|
if [ $failedVet ]; then
|
||||||
|
fails=yes
|
||||||
|
echo $failedVet
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ $fails ]; then
|
||||||
|
echo 'Please review and resolve the above issues and commit the result.'
|
||||||
|
else
|
||||||
|
echo 'All Go source files have been vetted.'
|
||||||
|
fi
|
Loading…
Reference in a new issue