too many files for shell during Make, convert .go and .sh to EOL=lf
This commit is contained in:
parent
83162717ed
commit
049e1bbf73
|
@ -1,2 +1,4 @@
|
|||
|
||||
* text=auto
|
||||
*.go text eol=lf
|
||||
*.sh text eol=lf
|
||||
common/test-fixtures/root/* eol=lf
|
9
Makefile
9
Makefile
|
@ -4,7 +4,7 @@ VET?=$(shell ls -d */ | grep -v vendor | grep -v website)
|
|||
GITSHA:=$(shell git rev-parse HEAD)
|
||||
# Get the current local branch name from git (if we can, this may be blank)
|
||||
GITBRANCH:=$(shell git symbolic-ref --short HEAD 2>/dev/null)
|
||||
GOFMT_FILES?=$$(find . -not -path "./vendor/*" -name "*.go")
|
||||
GOFMT_FILES?=find . -path ./vendor -prune -o -name "*.go"
|
||||
GOOS=$(shell go env GOOS)
|
||||
GOARCH=$(shell go env GOARCH)
|
||||
GOPATH=$(shell go env GOPATH)
|
||||
|
@ -57,10 +57,13 @@ dev: deps ## Build and install a development build
|
|||
@cp $(GOPATH)/bin/packer pkg/$(GOOS)_$(GOARCH)
|
||||
|
||||
fmt: ## Format Go code
|
||||
@gofmt -w -s $(GOFMT_FILES)
|
||||
@$(GOFMT_FILES) | xargs gofmt -w -s
|
||||
|
||||
fmt-check: ## Check go code formatting
|
||||
$(CURDIR)/scripts/gofmtcheck.sh $(GOFMT_FILES)
|
||||
@echo "==> Checking that code complies with gofmt requirements..."
|
||||
@echo "You can use the command: \`make fmt\` to reformat code."
|
||||
@$(GOFMT_FILES) | xargs $(CURDIR)/scripts/gofmtcheck.sh
|
||||
@echo "Check complete."
|
||||
|
||||
fmt-docs:
|
||||
@find ./website/source/docs -name "*.md" -exec pandoc --wrap auto --columns 79 --atx-headers -s -f "markdown_github+yaml_metadata_block" -t "markdown_github+yaml_metadata_block" {} -o {} \;
|
||||
|
|
|
@ -1,14 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Check gofmt
|
||||
echo "==> Checking that code complies with gofmt requirements..."
|
||||
gofmt_files=$(gofmt -s -l ${@})
|
||||
if [[ -n ${gofmt_files} ]]; then
|
||||
echo 'gofmt needs running on the following files:'
|
||||
echo "${gofmt_files}"
|
||||
echo "You can use the command: \`make fmt\` to reformat code."
|
||||
exit 1
|
||||
fi
|
||||
echo "Check passed."
|
||||
for f in $@; do
|
||||
[ -n "`dos2unix 2>/dev/null < $f | gofmt -s -d`" ] && echo $f
|
||||
done
|
||||
|
||||
# always return success or else 'make' will abort
|
||||
exit 0
|
||||
|
|
Loading…
Reference in New Issue