// The Gccgo toolchain.
type gccgoToolchain struct{}
-func (gccgoToolchain) compiler() string {
- if v := os.Getenv("GOC"); v != "" {
- return v
+var gccgoName, gccgoBin string
+
+func init() {
+ gccgoName = os.Getenv("GCCGO")
+ if gccgoName == "" {
+ gccgoName = defaultGCCGO
}
- return defaultGOC
+ gccgoBin, _ = exec.LookPath(gccgoName)
+}
+
+func (gccgoToolchain) compiler() string {
+ return gccgoBin
}
-func (tools gccgoToolchain) linker() string {
- return tools.compiler()
+func (gccgoToolchain) linker() string {
+ return gccgoBin
}
func (tools gccgoToolchain) gc(b *builder, p *Package, archive, obj string, importArgs []string, gofiles []string) (ofile string, output []byte, err error) {