diff options
| author | Shenghou Ma <minux@golang.org> | 2015-12-06 17:35:12 -0500 |
|---|---|---|
| committer | Minux Ma <minux@golang.org> | 2015-12-16 05:42:40 +0000 |
| commit | 86f1944e86ae3e07651dcbfafee37f1e3b0a917d (patch) | |
| tree | 128ffb831373ababa36b308cba3ef508a0156eaa /src/runtime/proc.go | |
| parent | 68c6aad58b5062e3dd2bc97a124871dd767168cc (diff) | |
| download | go-86f1944e86ae3e07651dcbfafee37f1e3b0a917d.tar.xz | |
cmd/dist, runtime: make runtime version available as runtime.buildVersion
So that there is a uniformed way to retrieve Go version from a Go
binary, starting from Go 1.4 (see https://golang.org/cl/117040043)
Updates #13507.
Change-Id: Iaa2b14fca2d8c4d883d3824e2efc82b3e6fe2624
Reviewed-on: https://go-review.googlesource.com/17459
Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/runtime/proc.go')
| -rw-r--r-- | src/runtime/proc.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/runtime/proc.go b/src/runtime/proc.go index d75af10206..04e4c7c548 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -10,6 +10,8 @@ import ( "unsafe" ) +var buildVersion = sys.TheVersion + // Goroutine scheduler // The scheduler's job is to distribute ready-to-run goroutines over worker threads. // @@ -445,10 +447,10 @@ func schedinit() { throw("unknown runnable goroutine during bootstrap") } - if sys.BuildVersion == "" { + if buildVersion == "" { // Condition should never trigger. This code just serves // to ensure runtimeĀ·buildVersion is kept in the resulting binary. - sys.BuildVersion = "unknown" + buildVersion = "unknown" } } |
