mirror of
https://github.com/golang/go
synced 2024-11-18 13:44:48 -07:00
cmd/go: add error for cross-compiled -race builds
Race builds require C dependencies, but setting up cross-compiled cgo builds is more complicated than just setting CGO_ENABLED, so don't suggest that. Fixes #37021
This commit is contained in:
parent
09630172d4
commit
cbf43c1bbb
@ -16,6 +16,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@ -84,7 +85,12 @@ func instrumentInit() {
|
||||
modeFlag := "-" + mode
|
||||
|
||||
if !cfg.BuildContext.CgoEnabled {
|
||||
fmt.Fprintf(os.Stderr, "go %s: %s requires cgo; enable cgo by setting CGO_ENABLED=1\n", flag.Args()[0], modeFlag)
|
||||
if runtime.GOOS != cfg.Goos || runtime.GOARCH != cfg.Goarch {
|
||||
fmt.Fprintf(os.Stderr, "go %s: %s requires cgo\n", flag.Args()[0], modeFlag)
|
||||
} else {
|
||||
fmt.Fprintf(os.Stderr, "go %s: %s requires cgo; enable cgo by setting CGO_ENABLED=1\n", flag.Args()[0], modeFlag)
|
||||
}
|
||||
|
||||
base.SetExitStatus(2)
|
||||
base.Exit()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user