re-init because of weird subtree shit

This commit is contained in:
41666 2020-09-15 22:25:26 -04:00
commit 68254ddd13
85 changed files with 13501 additions and 0 deletions

View file

@ -0,0 +1,14 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
go_library(
name = "version",
srcs = ["version.go"],
importpath = "github.com/roleypoly/roleypoly/src/common/version",
visibility = ["//visibility:public"],
)
go_test(
name = "version_test",
srcs = ["version_test.go"],
embed = [":version"],
)

View file

@ -0,0 +1,21 @@
package version
import (
"fmt"
)
var (
GitCommit = "unknown"
GitBranch = "unknown"
BuildDate = "unknown"
)
func StartupInfo(serviceName string) string {
return fmt.Sprintf(
"Starting %s service.\n Build %s (%s) at %s",
serviceName,
GitCommit,
GitBranch,
BuildDate,
)
}

View file

@ -0,0 +1,18 @@
package version
import (
"testing"
"time"
)
func TestStartup(t *testing.T) {
GitBranch = "test"
GitCommit = "e5fa44f2b31c1fb553b6021e7360d07d5d91ff5e"
BuildDate = time.Now().UTC().Format("2006-01-02T15:04:05.000Z")
expected := "Starting test service.\n Build e5fa44f2b31c1fb553b6021e7360d07d5d91ff5e (test) at " + BuildDate
value := StartupInfo("test")
if value != expected {
t.Error("Incorrect render, got `", value, "`")
}
}