1
0
mirror of https://github.com/containers/image.git synced 2025-04-18 19:44:05 +03:00
image/hack/validate.sh
Miloslav Trmač b6b60bf5af Stop setting GO111MODULE=on
It's the default since Go 1.16.

In theory the environment might be setting it to off, and breaking
our builds; unless something compelling comes up, I think that
hypothetical environment should be changed, nowadays.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2024-03-26 17:57:52 +01:00

26 lines
546 B
Bash
Executable File

#!/bin/bash
set -eo pipefail
eval $(go env)
PATH="$GOPATH/bin:$PATH"
die() { echo "Error: ${1:-No message provided}" > /dev/stderr; exit 1; }
# Always run from the repository root
cd $(dirname "${BASH_SOURCE[0]}")/../
if [[ -z $(type -P gofmt) ]]; then
die "Unable to find 'gofmt' binary in \$PATH: $PATH"
fi
echo "Executing go vet"
go vet -tags="$BUILDTAGS" ./...
echo "Executing gofmt"
OUTPUT=$(gofmt -s -l . | sed -e '/^vendor/d')
if [[ ! -z "$OUTPUT" ]]; then
die "Please fix the formatting of the following files:
$OUTPUT"
fi