aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKegsay <kegan@matrix.org>2020-05-19 16:42:30 +0100
committerGitHub <noreply@github.com>2020-05-19 16:42:30 +0100
commit5faecdac828592b6cf9d2851e13af8fb6d1df30a (patch)
tree646c1c7b80ff59ba0dacbd8fb124cc2b6f8b2fe2
parent8b3100935ccc2efec67b26251176c2f8b6ad2be2 (diff)
Bake in git commit into dendritejs binary (#1048)
-rwxr-xr-xbuild-dendritejs.sh4
-rw-r--r--cmd/dendritejs/main.go4
2 files changed, 7 insertions, 1 deletions
diff --git a/build-dendritejs.sh b/build-dendritejs.sh
new file mode 100755
index 00000000..cd42a6be
--- /dev/null
+++ b/build-dendritejs.sh
@@ -0,0 +1,4 @@
+#!/bin/bash -eu
+
+export GIT_COMMIT=$(git rev-list -1 HEAD) && \
+GOOS=js GOARCH=wasm go build -ldflags "-X main.GitCommit=$GIT_COMMIT" -o main.wasm ./cmd/dendritejs \ No newline at end of file
diff --git a/cmd/dendritejs/main.go b/cmd/dendritejs/main.go
index 618ebbc6..5bdf18ef 100644
--- a/cmd/dendritejs/main.go
+++ b/cmd/dendritejs/main.go
@@ -46,8 +46,10 @@ import (
_ "github.com/matrix-org/go-sqlite3-js"
)
+var GitCommit string
+
func init() {
- fmt.Println("dendrite.js starting...")
+ fmt.Printf("[%s] dendrite.js starting...\n", GitCommit)
}
const keyNameEd25519 = "_go_ed25519_key"