...

Text file src/github.com/docker/distribution/project/hooks/pre-commit

Documentation: github.com/docker/distribution/project/hooks

     1#!/bin/sh
     2
     3REPO_ROOT=$(git rev-parse --show-toplevel)
     4RESOLVE_REPO_ROOT_STATUS=$?
     5if [ "$RESOLVE_REPO_ROOT_STATUS" -ne "0" ]; then
     6	printf "Unable to resolve repository root. Error:\n%s\n" "$RESOLVE_REPO_ROOT_STATUS" > /dev/stderr
     7	exit $RESOLVE_REPO_ROOT_STATUS
     8fi
     9
    10cd $REPO_ROOT
    11
    12GOFMT_ERRORS=$(gofmt -s -l . 2>&1)
    13if [ -n "$GOFMT_ERRORS" ]; then
    14	printf 'gofmt failed for the following files:\n%s\n\nPlease run "gofmt -s -l ." in the root of your repository before committing\n' "$GOFMT_ERRORS" > /dev/stderr
    15	exit 1
    16fi
    17
    18GOLINT_ERRORS=$(golint ./... 2>&1)
    19if [ -n "$GOLINT_ERRORS" ]; then
    20	printf "golint failed with the following errors:\n%s\n" "$GOLINT_ERRORS" > /dev/stderr
    21	exit 1
    22fi
    23
    24GOVET_ERRORS=$(go vet ./... 2>&1)
    25GOVET_STATUS=$?
    26if [ "$GOVET_STATUS" -ne "0" ]; then
    27	printf "govet failed with the following errors:\n%s\n" "$GOVET_ERRORS" > /dev/stderr
    28	exit $GOVET_STATUS
    29fi

View as plain text