🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
Replace lefthook with shell script
Deluan037f6b606e7b
diff --git a/Makefile b/Makefileindex 6578183e6..c5a821ac3 100644--- a/Makefile+++ b/Makefile@@ -48,16 +48,20 @@ setup:@(cd ./ui && npm ci).PHONY: setup-setup-dev: setup+setup-dev: setup setup-git@which wire || (echo "Installing Wire" && GO111MODULE=off go get -u github.com/google/wire/cmd/wire)@which ginkgo || (echo "Installing Ginkgo" && GO111MODULE=off go get -u github.com/onsi/ginkgo/ginkgo)@which goose || (echo "Installing Goose" && GO111MODULE=off go get -u github.com/pressly/goose/cmd/goose)@which reflex || (echo "Installing Reflex" && GO111MODULE=off go get -u github.com/cespare/reflex)@which golangci-lint || (echo "Installing GolangCI-Lint" && cd .. && GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/[email protected])- @which lefthook || (echo "Installing Lefthook" && GO111MODULE=off go get -u github.com/Arkweid/lefthook)- @lefthook install+ @which goimports || (echo "Installing goimports" && GO111MODULE=off go get -u golang.org/x/tools/cmd/goimports).PHONY: setup-dev+setup-git:+ @mkdir -p .git/hooks+ (cd .git/hooks && ln -sf ../../git/* .)+.PHONY: setup-git+Jamstash-master:wget -N https://github.com/tsquillario/Jamstash/archive/master.zipunzip -o master.zip@@ -68,11 +72,6 @@ Jamstash-master:check_env: check_go_env check_node_env.PHONY: check_env-check_hooks:- @lefthook add pre-commit- @lefthook add pre-push-.PHONY: check_hooks-check_go_env:@(hash go) || (echo "\nERROR: GO environment not setup properly!\n"; exit 1)@go version | grep -q $(GO_VERSION) || (echo "\nERROR: Please upgrade your GO version\nThis project requires version $(GO_VERSION)"; exit 1)diff --git a/git/pre-commit b/git/pre-commitnew file mode 100755index 000000000..ef07e99cb--- /dev/null+++ b/git/pre-commit@@ -0,0 +1,32 @@+#!/bin/sh+# Copyright 2012 The Go Authors. All rights reserved.+# Use of this source code is governed by a BSD-style+# license that can be found in the LICENSE file.++# git gofmt pre-commit hook+#+# To use, store as .git/hooks/pre-commit inside your repository and make sure+# it has execute permissions.+#+# This script does not handle file names that contain spaces.++if which goimports > /dev/null; then+ gofmtcmd=goimports+else+ gofmtcmd=gofmt+fi++gofiles=$(git diff --cached --name-only --diff-filter=ACM | grep '.go$')+[ -z "$gofiles" ] && exit 0++unformatted=$($gofmtcmd -l $gofiles)+[ -z "$unformatted" ] && exit 0++# Some files are not gofmt'd. Print message and fail.++echo >&2 "Go files must be formatted with '$gofmtcmd'. Please run:"+for fn in $unformatted; do+ echo >&2 " $gofmtcmd -w $PWD/$fn"+done++exit 1diff --git a/git/pre-push b/git/pre-pushnew file mode 100755index 000000000..aa43f4b02--- /dev/null+++ b/git/pre-push@@ -0,0 +1,4 @@+#!/bin/sh++golangci-lint run+make test\ No newline at end of filediff --git a/lefthook.yml b/lefthook.ymldeleted file mode 100644index efce97288..000000000--- a/lefthook.yml+++ /dev/null@@ -1,17 +0,0 @@-pre-push:- parallel: true- commands:- unit-tests:- tags: tests- run: go test ./...- lint:- tags: tests- run: golangci-lint run--pre-commit:- parallel: false- commands:- gofmt:- tags: style- glob: "*.go"- run: gofmt -w {staged_files}; git add {staged_files}