cmd/bench: generate branch tag

This change modifies cmd/bench to pick up BENCH_BRANCH from the builder
environment and prints the "branch" benchmark tag.

Change-Id: I3ca12ac91d98b6fd20e9ae06816e1cfe30364eb6
Reviewed-on: https://go-review.googlesource.com/c/benchmarks/+/385734
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
diff --git a/cmd/bench/main.go b/cmd/bench/main.go
index 12fe37b..82460b5 100644
--- a/cmd/bench/main.go
+++ b/cmd/bench/main.go
@@ -102,6 +102,13 @@
 		toolchains = append(toolchains, toolchainFromGOROOT("baseline", gorootBaseline))
 	}
 
+	// Try to identify the Go branch. If we can't, just make sure we say so explicitly.
+	branch := os.Getenv("BENCH_BRANCH")
+	if branch == "" {
+		branch = "unknown"
+	}
+	fmt.Printf("branch: %s\n", branch)
+
 	// Run benchmarks against the toolchains.
 	if err := run(toolchains); err != nil {
 		log.Print("FAIL")