diff --git a/.lefthook/pre-commit/lint b/.lefthook/pre-commit/lint new file mode 100755 index 00000000..8efd0cdc --- /dev/null +++ b/.lefthook/pre-commit/lint @@ -0,0 +1,10 @@ +#!/bin/sh + +if ! [ -x "$(which brew)" ]; then + export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$(brew --prefix libffi)/lib/pkgconfig" +fi + +export CGO_LDFLAGS_ALLOW="-s|-w" +export CGO_CFLAGS_ALLOW="-Xpreprocessor" + +golangci-lint run diff --git a/.lefthook/pre-push/test b/.lefthook/pre-push/test new file mode 100755 index 00000000..d350cef4 --- /dev/null +++ b/.lefthook/pre-push/test @@ -0,0 +1,10 @@ +#!/bin/sh + +if ! [ -x "$(which brew)" ]; then + export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$(brew --prefix libffi)/lib/pkgconfig" +fi + +export CGO_LDFLAGS_ALLOW="-s|-w" +export CGO_CFLAGS_ALLOW="-Xpreprocessor" + +go test diff --git a/lefthook.yml b/lefthook.yml new file mode 100644 index 00000000..ebdb80cb --- /dev/null +++ b/lefthook.yml @@ -0,0 +1,9 @@ +pre-commit: + scripts: + lint: + tags: lint + +pre-push: + scripts: + test: + tags: test