playground: display the version of Go in use
Fixes golang/go#12218
Change-Id: Ie8bdfdecdeb5b7a61eaa742b86612afef704c2fe
Reviewed-on: https://go-review.googlesource.com/98446
Reviewed-by: Andrew Bonventre <andybons@golang.org>
diff --git a/edit.go b/edit.go
index bb5eaa3..b69c1c0 100644
--- a/edit.go
+++ b/edit.go
@@ -8,6 +8,7 @@
"fmt"
"html/template"
"net/http"
+ "runtime"
"strings"
"cloud.google.com/go/datastore"
@@ -21,6 +22,7 @@
Snippet *snippet
Share bool
Analytics bool
+ GoVersion string
}
func (s *server) handleEdit(w http.ResponseWriter, r *http.Request) {
@@ -67,6 +69,7 @@
Snippet: snip,
Share: allowShare(r),
Analytics: r.Host == hostname,
+ GoVersion: runtime.Version(),
}
if err := editTemplate.Execute(w, data); err != nil {
s.log.Errorf("editTemplate.Execute(w, %+v): %v", data, err)
diff --git a/edit.html b/edit.html
index 8bf62f2..0be1443 100644
--- a/edit.html
+++ b/edit.html
@@ -170,7 +170,7 @@
<p>
The playground uses the latest stable release of Go.<br>
-To find the precise version, run <a href="/p/1VcPUlPk_3">this program</a>.
+The current version is <a href="/p/1VcPUlPk_3">{{.GoVersion}}</a>.
</p>
<p>