mirror of
https://github.com/golang/go
synced 2024-11-19 09:04:41 -07:00
cmd/go: add better error message when gccgo is missing
Fixes #19628 Change-Id: I19baf694c66aaca8e0d95297c97aacb40db24c47 Reviewed-on: https://go-review.googlesource.com/40250 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
ab0e9019ea
commit
20edbda5ea
@ -2499,23 +2499,34 @@ func (gcToolchain) cc(b *Builder, p *load.Package, objdir, ofile, cfile string)
|
||||
type gccgoToolchain struct{}
|
||||
|
||||
var GccgoName, GccgoBin string
|
||||
var gccgoErr error
|
||||
|
||||
func init() {
|
||||
GccgoName = os.Getenv("GCCGO")
|
||||
if GccgoName == "" {
|
||||
GccgoName = "gccgo"
|
||||
}
|
||||
GccgoBin, _ = exec.LookPath(GccgoName)
|
||||
GccgoBin, gccgoErr = exec.LookPath(GccgoName)
|
||||
}
|
||||
|
||||
func (gccgoToolchain) compiler() string {
|
||||
checkGccgoBin()
|
||||
return GccgoBin
|
||||
}
|
||||
|
||||
func (gccgoToolchain) linker() string {
|
||||
checkGccgoBin()
|
||||
return GccgoBin
|
||||
}
|
||||
|
||||
func checkGccgoBin() {
|
||||
if gccgoErr == nil {
|
||||
return
|
||||
}
|
||||
fmt.Fprintf(os.Stderr, "cmd/go: gccgo: %s\n", gccgoErr)
|
||||
os.Exit(2)
|
||||
}
|
||||
|
||||
func (tools gccgoToolchain) gc(b *Builder, p *load.Package, archive, obj string, asmhdr bool, importArgs []string, gofiles []string) (ofile string, output []byte, err error) {
|
||||
out := "_go_.o"
|
||||
ofile = obj + out
|
||||
|
Loading…
Reference in New Issue
Block a user