From 5faecdac828592b6cf9d2851e13af8fb6d1df30a Mon Sep 17 00:00:00 2001 From: Kegsay Date: Tue, 19 May 2020 16:42:30 +0100 Subject: [PATCH] Bake in git commit into dendritejs binary (#1048) --- build-dendritejs.sh | 4 ++++ cmd/dendritejs/main.go | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100755 build-dendritejs.sh 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"