Standard library / runtime
runtime.GOROOT()
Reports the Go tree path known to the runtime; it need not exist on a deployed machine. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func GOROOT() stringReturn Value
string
Go root path known to the runtime.
Working Example
Example Snippetgo
package main
import ( "fmt" "runtime")
func main() { fmt.Println(runtime.GOROOT() != "") }