tg.creatingTemp(exe)
        tg.run("build", "-o", exe, "p")
 }
+
+func TestBuildTagsNoComma(t *testing.T) {
+       tg := testgo(t)
+       defer tg.cleanup()
+       tg.makeTempdir()
+       tg.setenv("GOPATH", tg.path("go"))
+       tg.run("install", "-tags", "tag1 tag2", "math")
+       tg.runFail("install", "-tags", "tag1,tag2", "math")
+       tg.grepBoth("space-separated list contains comma", "-tags with a comma-separated list didn't error")
+       tg.runFail("build", "-tags", "tag1,tag2", "math")
+       tg.grepBoth("space-separated list contains comma", "-tags with a comma-separated list didn't error")
+}
 
                fmt.Fprintf(os.Stderr, "cmd/go: unsupported GOOS/GOARCH pair %s/%s\n", cfg.Goos, cfg.Goarch)
                os.Exit(2)
        }
+       for _, tag := range cfg.BuildContext.BuildTags {
+               if strings.Contains(tag, ",") {
+                       fmt.Fprintf(os.Stderr, "cmd/go: -tags space-separated list contains comma\n")
+                       os.Exit(2)
+               }
+       }
 
        // Build list of all actions, assigning depth-first post-order priority.
        // The original implementation here was a true queue