too many files for shell during Make, convert .go and .sh to EOL=lf

This commit is contained in:
Matthew Patton 2017-02-01 22:57:36 -05:00 committed by Matthew Patton
parent 83162717ed
commit 049e1bbf73
3 changed files with 14 additions and 15 deletions

6
.gitattributes vendored
View File

@ -1,2 +1,4 @@
* text=auto
common/test-fixtures/root/* eol=lf *.go text eol=lf
*.sh text eol=lf
common/test-fixtures/root/* eol=lf

View File

@ -4,7 +4,7 @@ VET?=$(shell ls -d */ | grep -v vendor | grep -v website)
GITSHA:=$(shell git rev-parse HEAD) GITSHA:=$(shell git rev-parse HEAD)
# Get the current local branch name from git (if we can, this may be blank) # 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) 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) GOOS=$(shell go env GOOS)
GOARCH=$(shell go env GOARCH) GOARCH=$(shell go env GOARCH)
GOPATH=$(shell go env GOPATH) GOPATH=$(shell go env GOPATH)
@ -57,10 +57,13 @@ dev: deps ## Build and install a development build
@cp $(GOPATH)/bin/packer pkg/$(GOOS)_$(GOARCH) @cp $(GOPATH)/bin/packer pkg/$(GOOS)_$(GOARCH)
fmt: ## Format Go code fmt: ## Format Go code
@gofmt -w -s $(GOFMT_FILES) @$(GOFMT_FILES) | xargs gofmt -w -s
fmt-check: ## Check go code formatting 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: 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 {} \; @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 {} \;

View File

@ -1,14 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Check gofmt for f in $@; do
echo "==> Checking that code complies with gofmt requirements..." [ -n "`dos2unix 2>/dev/null < $f | gofmt -s -d`" ] && echo $f
gofmt_files=$(gofmt -s -l ${@}) done
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."
# always return success or else 'make' will abort
exit 0 exit 0