Commit fed5f051 authored by Steven Allen's avatar Steven Allen

build: simplify on gofmt

parent 17d53390
//go:generate git submodule update --init ./dir-index-html //go:generate git submodule update --init ./dir-index-html
//go:generate go run github.com/go-bindata/go-bindata/v3/go-bindata -mode=0644 -modtime=1403768328 -pkg=assets init-doc dir-index-html/dir-index.html dir-index-html/knownIcons.txt //go:generate go run github.com/go-bindata/go-bindata/v3/go-bindata -mode=0644 -modtime=1403768328 -pkg=assets init-doc dir-index-html/dir-index.html dir-index-html/knownIcons.txt
//go:generate gofmt -w bindata.go //go:generate gofmt -sw bindata.go
//go:generate sh -c "sed -i \"s/.*BindataVersionHash.*/BindataVersionHash=\\\"$(git hash-object bindata.go)\\\"/\" bindata_version_hash.go" //go:generate sh -c "sed -i \"s/.*BindataVersionHash.*/BindataVersionHash=\\\"$(git hash-object bindata.go)\\\"/\" bindata_version_hash.go"
//go:generate gofmt -w bindata_version_hash.go //go:generate gofmt -sw bindata_version_hash.go
package assets package assets
import ( import (
......
...@@ -4,7 +4,7 @@ T="$(mktemp)" ...@@ -4,7 +4,7 @@ T="$(mktemp)"
find . \ find . \
-path ./test/sharness -prune \ -path ./test/sharness -prune \
-o -path ./plugin/loader/preload.go -prune \ -o -path ./plugin/loader/preload.go -prune \
-o -name '*.go' -print0 | xargs -0 gofmt -l > "$T" -o -name '*.go' -print0 | xargs -0 gofmt -sl > "$T"
if [ -n "$(cat $T)" ]; then if [ -n "$(cat $T)" ]; then
echo "Following Go code is not formatted." echo "Following Go code is not formatted."
......
#!/bin/sh
#TODO add go lint and go vet
verify_gofmt() {
GOFMT="gofmt -s"
cd "$(git rev-parse --show-toplevel)"
bad_files=$($GOFMT -l .)
cd -
if [[ -n $bad_files ]]; then
echo "You have to run '$GOFMT' on these files:"
echo "$bad_files"
false
else
true
fi
}
verify_gofmt
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment