diff options
author | Russ Cox <rsc@golang.org> | 2010-03-16 23:10:33 -0700 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2010-03-16 23:10:33 -0700 |
commit | 504ccfeeda3134aa47e4a9646c8885782f513539 (patch) | |
tree | 54618cda4018c5a0abe309fb4d7bf02d9c71551c /src/pkg/runtime/extern.go | |
parent | 95426769e7a75e8d10e0a37022c694a7283f4649 (diff) | |
download | golang-504ccfeeda3134aa47e4a9646c8885782f513539.tar.gz |
runtime: add GOROOT and Version
R=r
CC=golang-dev
http://codereview.appspot.com/608041
Diffstat (limited to 'src/pkg/runtime/extern.go')
-rw-r--r-- | src/pkg/runtime/extern.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/pkg/runtime/extern.go b/src/pkg/runtime/extern.go index f34bb2256..b4d903c30 100644 --- a/src/pkg/runtime/extern.go +++ b/src/pkg/runtime/extern.go @@ -150,3 +150,23 @@ func GC() // TODO(rsc): allow f to have (ignored) return values // func SetFinalizer(x, f interface{}) + +func getgoroot() string + +// GOROOT returns the root of the Go tree. +// It uses the GOROOT environment variable, if set, +// or else the root used during the Go build. +func GOROOT() string { + s := getgoroot() + if s != "" { + return s + } + return defaultGoroot +} + +// Version returns the Go tree's version string. +// It is either a sequence number or, when possible, +// a release tag like "release.2010-03-04". +// A trailing + indicates that the tree had local modifications +// at the time of the build. +func Version() string { return defaultVersion } |