initial commit: ifinit and boolnames
This commit is contained in:
37
build.sh
Executable file
37
build.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
|
||||
cd "$SCRIPT_DIR" # .custom-gcl.yaml is only discovered in the current directory
|
||||
|
||||
BIN="bin/golint"
|
||||
STAMP="bin/.golint.stamp"
|
||||
|
||||
# Everything that changes the compiled binary: the linter sources, and the build
|
||||
# config that pins the golangci-lint version the plugin links against. testdata
|
||||
# is excluded -- fixtures are not compiled into the binary.
|
||||
current_stamp() {
|
||||
{
|
||||
find . -type f ! -path '*/testdata/*' | sort | xargs shasum -a 256
|
||||
shasum -a 256 .custom-gcl.yaml
|
||||
} | shasum -a 256 | cut -d' ' -f1
|
||||
}
|
||||
|
||||
if [ "$1" = "--if-needed" ] &&
|
||||
[ -x "$BIN" ] &&
|
||||
[ -f "$STAMP" ] &&
|
||||
[ "$(cat "$STAMP")" = "$(current_stamp)" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if ! [ -x "$(command -v golangci-lint)" ]; then
|
||||
echo "golangci-lint is not installed. Please install it from https://golangci-lint.run/welcome/install/"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Building golint (golangci-lint + custom linters)..."
|
||||
golangci-lint custom
|
||||
current_stamp > "$STAMP"
|
||||
|
||||
echo "Done: $SCRIPT_DIR/$BIN"
|
||||
Reference in New Issue
Block a user