Merge pull request #6227 from hashicorp/revert-4494

Revert "Merge pull request #4494 from tb3088/EOL-handling"
This commit is contained in:
Matthew Hooker 2018-05-01 13:11:39 -07:00 committed by GitHub
commit 64d1265ab8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 10 deletions

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 . -path ./vendor -prune -o -name "*.go" GOFMT_FILES?=$$(find . -not -path "./vendor/*" -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)
@ -58,13 +58,10 @@ 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_FILES) | xargs gofmt -w -s @gofmt -w -s $(GOFMT_FILES)
fmt-check: ## Check go code formatting fmt-check: ## Check go code formatting
@echo "==> Checking that code complies with gofmt requirements..." $(CURDIR)/scripts/gofmtcheck.sh $(GOFMT_FILES)
@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,8 +1,14 @@
#!/usr/bin/env bash #!/usr/bin/env bash
for f in $@; do # Check gofmt
[ -n "`dos2unix 2>/dev/null < $f | gofmt -s -d`" ] && echo $f echo "==> Checking that code complies with gofmt requirements..."
done 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."
# always return success or else 'make' will abort
exit 0 exit 0