Change the run.go driver to recognize the "gc" build tag.
Change existing tests to use the "gc" build tag if they use some
feature that seems specific to the gc compiler, such as passing specific
options to or expecting specific behavior from "go tool compile".
Change tests to use the "!gccgo" build tag if they use "go build" or
"go run", as while those might work with compilers other than gc, they
won't work with the way that gccgo runs its testsuite (which happens
independently of the go command).
For #43252
Change-Id: I666e04b6d7255a77dfc256ee304094e3a6bb15ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/279052
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
-// +build !nacl,!js
+// +build !nacl,!js,gc
// run
// Copyright 2010 The Go Authors. All rights reserved.
-// +build !nacl,!js,!windows
+// +build !nacl,!js,!windows,gc
// run
// Copyright 2011 The Go Authors. All rights reserved.
-// +build linux,!ppc64,!riscv64
+// +build linux,!ppc64,!riscv64,gc
// run
// Copyright 2015 The Go Authors. All rights reserved.
-// +build !nacl,!js
+// +build !nacl,!js,gc
// run
// Copyright 2015 The Go Authors. All rights reserved.
+// +build gc
// run
// Copyright 2015 The Go Authors. All rights reserved.
-// +build !nacl,!js,!android
+// +build !nacl,!js,!android,gc
// run
// Copyright 2016 The Go Authors. All rights reserved.
-// +build !nacl,!js,!android
+// +build !nacl,!js,!android,!gccgo
// run
// Copyright 2016 The Go Authors. All rights reserved.
-// +build !nacl,!js
+// +build !nacl,!js,!gccgo
// run
// Copyright 2017 The Go Authors. All rights reserved.
+// +build !js,gc
// run
// Copyright 2017 The Go Authors. All rights reserved.
"log"
"os"
"os/exec"
- "runtime"
"strings"
)
func main() {
- if runtime.Compiler != "gc" || runtime.GOOS == "js" {
- return
- }
-
f, err := ioutil.TempFile("", "issue21317.go")
if err != nil {
log.Fatal(err)
// run
-// +build !nacl,!js
+// +build !nacl,!js,!gccgo
// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
+// +build !js,gc
// run
// Copyright 2017 The Go Authors. All rights reserved.
"os"
"os/exec"
"path/filepath"
- "runtime"
"strings"
)
func main() {
- if runtime.GOOS == "js" {
- return // no file system available on builders
- }
-
f, err := ioutil.TempFile("", "issue22660.go")
if err != nil {
log.Fatal(err)
+// +build !js,gc
// run
// Copyright 2018 The Go Authors. All rights reserved.
"log"
"os"
"os/exec"
- "runtime"
"strings"
)
}
func main() {
- if runtime.GOOS == "js" {
- return // can not exec go tool
- }
-
f, err := ioutil.TempFile("", "issue22662b.go")
if err != nil {
log.Fatal(err)
-// +build !nacl,!js
+// +build !nacl,!js,!gccgo
// run
// Copyright 2019 The Go Authors. All rights reserved.
-// +build !nacl,!js
+// +build !nacl,!js,!gccgo
// run
// Copyright 2019 The Go Authors. All rights reserved.
// run
-// +build !nacl,!js
+// +build !nacl,!js,gc
// Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
+// +build !js,gc
// run
// Copyright 2014 The Go Authors. All rights reserved.
"os/exec"
"path/filepath"
"regexp"
- "runtime"
)
func main() {
- if runtime.Compiler != "gc" || runtime.GOOS == "js" {
- return
- }
-
err := os.Chdir(filepath.Join("fixedbugs", "issue9355.dir"))
check(err)
-// +build !nacl,!js
+// +build !nacl,!js,gc
// run
// Copyright 2015 The Go Authors. All rights reserved.
-// +build !nacl,!js
+// +build !nacl,!js,gc
// run
// Copyright 2016 The Go Authors. All rights reserved.
-// +build !nacl,!js
+// +build !nacl,!js,gc
// run
// Copyright 2014 The Go Authors. All rights reserved.
-// +build !nacl,!js,!aix,!gcflags_noopt
+// +build !nacl,!js,!aix,!gcflags_noopt,gc
// run
// Copyright 2014 The Go Authors. All rights reserved.
}
}
- if name == ctxt.GOOS || name == ctxt.GOARCH {
+ if name == ctxt.GOOS || name == ctxt.GOARCH || name == "gc" {
return true
}
-// +build !nacl,!js
+// +build !nacl,!js,gc
// run
// Copyright 2014 The Go Authors. All rights reserved.