build: simplify on gofmt
Steven Allen committed
Feb 8, 2021 at 12:41 UTC
fed5f05134b70a9e51a4c13498dd2708111a4bc1
3 files changed
+3
-22
assets/assets.go
+2
-2
@@ -1,8 +1,8 @@
1
//go:generate git submodule update --init ./dir-index-html
2
//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
3
-//go:generate gofmt -w bindata.go
3
+//go:generate gofmt -sw bindata.go
4
//go:generate sh -c "sed -i \"s/.*BindataVersionHash.*/BindataVersionHash=\\\"$(git hash-object bindata.go)\\\"/\" bindata_version_hash.go"
5
-//go:generate gofmt -w bindata_version_hash.go
5
+//go:generate gofmt -sw bindata_version_hash.go
6
package assets
7
8
import (
bin/test-go-fmt
+1
-1
@@ -4,7 +4,7 @@ T="$(mktemp)"
4
find . \
5
-path ./test/sharness -prune \
6
-o -path ./plugin/loader/preload.go -prune \
7
- -o -name '*.go' -print0 | xargs -0 gofmt -l > "$T"
7
+ -o -name '*.go' -print0 | xargs -0 gofmt -sl > "$T"
8
9
if [ -n "$(cat $T)" ]; then
10
echo "Following Go code is not formatted."
test/bin/verify-go-fmt.sh
deleted
-19
@@ -1,19 +0,0 @@
1
-#!/bin/sh
2
-
3
-#TODO add go lint and go vet
4
-
5
-verify_gofmt() {
6
- GOFMT="gofmt -s"
7
- cd "$(git rev-parse --show-toplevel)"
8
- bad_files=$($GOFMT -l .)
9
- cd -
10
- if [[ -n $bad_files ]]; then
11
- echo "You have to run '$GOFMT' on these files:"
12
- echo "$bad_files"
13
- false
14
- else
15
- true
16
- fi
17
-}
18
-
19
-verify_gofmt