summaryrefslogtreecommitdiff
path: root/libgo/go/cmd/go/internal/work/action.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/cmd/go/internal/work/action.go')
-rw-r--r--libgo/go/cmd/go/internal/work/action.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/libgo/go/cmd/go/internal/work/action.go b/libgo/go/cmd/go/internal/work/action.go
index eabac6bd14e..db422fd9935 100644
--- a/libgo/go/cmd/go/internal/work/action.go
+++ b/libgo/go/cmd/go/internal/work/action.go
@@ -291,11 +291,12 @@ func (b *Builder) Init() {
}
}
- if _, ok := cfg.OSArchSupportsCgo[cfg.Goos+"/"+cfg.Goarch]; !ok && cfg.BuildContext.Compiler == "gc" {
- fmt.Fprintf(os.Stderr, "cmd/go: unsupported GOOS/GOARCH pair %s/%s\n", cfg.Goos, cfg.Goarch)
+ if err := CheckGOOSARCHPair(cfg.Goos, cfg.Goarch); err != nil {
+ fmt.Fprintf(os.Stderr, "cmd/go: %v\n", err)
base.SetExitStatus(2)
base.Exit()
}
+
for _, tag := range cfg.BuildContext.BuildTags {
if strings.Contains(tag, ",") {
fmt.Fprintf(os.Stderr, "cmd/go: -tags space-separated list contains comma\n")
@@ -305,6 +306,13 @@ func (b *Builder) Init() {
}
}
+func CheckGOOSARCHPair(goos, goarch string) error {
+ if _, ok := cfg.OSArchSupportsCgo[goos+"/"+goarch]; !ok && cfg.BuildContext.Compiler == "gc" {
+ return fmt.Errorf("unsupported GOOS/GOARCH pair %s/%s", goos, goarch)
+ }
+ return nil
+}
+
// NewObjdir returns the name of a fresh object directory under b.WorkDir.
// It is up to the caller to call b.Mkdir on the result at an appropriate time.
// The result ends in a slash, so that file names in that directory
@@ -707,7 +715,7 @@ func (b *Builder) addInstallHeaderAction(a *Action) {
}
// buildmodeShared takes the "go build" action a1 into the building of a shared library of a1.Deps.
-// That is, the input a1 represents "go build pkgs" and the result represents "go build -buidmode=shared pkgs".
+// That is, the input a1 represents "go build pkgs" and the result represents "go build -buildmode=shared pkgs".
func (b *Builder) buildmodeShared(mode, depMode BuildMode, args []string, pkgs []*load.Package, a1 *Action) *Action {
name, err := libname(args, pkgs)
if err != nil {