summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2021-08-25 09:46:36 +0200
committerMartin Polden <mpolden@mpolden.no>2021-08-25 09:56:41 +0200
commit0af66f1a59ab99030c82208c9505c811b96dc171 (patch)
treea427033c778dab40ca3aa2638bbd0c2696681934 /client
parent05f91bd3f9eda63d492e1b91816be3602d06ebc1 (diff)
Check format when building
Diffstat (limited to 'client')
-rw-r--r--client/go/.gitignore1
-rw-r--r--client/go/Makefile15
-rwxr-xr-xclient/go/build.sh7
3 files changed, 16 insertions, 7 deletions
diff --git a/client/go/.gitignore b/client/go/.gitignore
index e660fd93d31..43fd09cd9d2 100644
--- a/client/go/.gitignore
+++ b/client/go/.gitignore
@@ -1 +1,2 @@
bin/
+!Makefile
diff --git a/client/go/Makefile b/client/go/Makefile
new file mode 100644
index 00000000000..db16b495b74
--- /dev/null
+++ b/client/go/Makefile
@@ -0,0 +1,15 @@
+# Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+all: test checkfmt install
+
+install:
+ env GOBIN=$(PWD)/bin go install ./...
+
+test:
+ go test ./...
+
+checkfmt:
+ @bash -c "diff --line-format='%L' <(echo -n) <(gofmt -l .)" || { echo "one or more files need to be formatted: try make fmt to fix this automatically"; exit 1; }
+
+fmt:
+ gofmt -w .
diff --git a/client/go/build.sh b/client/go/build.sh
deleted file mode 100755
index 6d9416e8950..00000000000
--- a/client/go/build.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-# Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-# Execute from this directory to build the command-line client to bin/vespa
-export GOBIN=`pwd`/bin
-go test ./...
-go install
-