File: validate.sh

package info (click to toggle)
golang-github-containers-image 5.28.0-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 5,104 kB
  • sloc: sh: 194; makefile: 73
file content (25 lines) | stat: -rwxr-xr-x 563 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/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"
GO111MODULE="on" 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