blob: ca3db6584009bf1dfcd7eb6f53f94a0c5e3b1ecf [file] [log] [blame]
Serge Bazanskiab4ef132021-09-24 13:58:13 +02001// gotoolchain provides information about the Go toolchain used on the host by
2// rules_go.
3package gotoolchain
4
5import (
6 "fmt"
7
8 "github.com/bazelbuild/rules_go/go/tools/bazel"
9)
10
11func mustRunfile(s string) string {
12 res, err := bazel.Runfile(s)
13 if err != nil {
14 panic(fmt.Sprintf("runfile %q not found: %v", s, err))
15 }
16 return res
17}
18
19var (
20 // Go is a path to the `go` executable.
21 Go = mustRunfile(`GOTOOL`)
22 // Root is the GOROOT path.
23 Root = mustRunfile(`GOROOT`)
24)