aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/testdata/script
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/go/testdata/script')
-rw-r--r--src/cmd/go/testdata/script/build_gcflags_order.txt20
-rw-r--r--src/cmd/go/testdata/script/build_runtime_gcflags.txt2
-rw-r--r--src/cmd/go/testdata/script/gcflags_patterns.txt22
3 files changed, 32 insertions, 12 deletions
diff --git a/src/cmd/go/testdata/script/build_gcflags_order.txt b/src/cmd/go/testdata/script/build_gcflags_order.txt
new file mode 100644
index 0000000000..0ffe1570f6
--- /dev/null
+++ b/src/cmd/go/testdata/script/build_gcflags_order.txt
@@ -0,0 +1,20 @@
+# Tests golang.org/issue/47682
+# Flags specified with -gcflags should appear after other flags generated by cmd/go.
+
+cd m
+go build -n -gcflags=-lang=go1.17
+stderr ' -lang=go1.16.* -lang=go1.17'
+
+-- m/go.mod --
+module example.com
+
+go 1.16
+
+-- m/main.go --
+package main
+
+func main() {
+ var s = []int{1, 2, 3}
+ var pa = (*[2]int)(s[1:])
+ println(pa[1])
+}
diff --git a/src/cmd/go/testdata/script/build_runtime_gcflags.txt b/src/cmd/go/testdata/script/build_runtime_gcflags.txt
index da1b65f06c..c87e480911 100644
--- a/src/cmd/go/testdata/script/build_runtime_gcflags.txt
+++ b/src/cmd/go/testdata/script/build_runtime_gcflags.txt
@@ -8,4 +8,4 @@ mkdir $GOCACHE
# Verify the standard library (specifically runtime/internal/atomic) can be
# built with -gcflags when -n is given. See golang.org/issue/29346.
go build -n -gcflags=all='-l' std
-stderr 'compile.* -l .* runtime/internal/atomic'
+stderr 'compile.* runtime/internal/atomic .* -l'
diff --git a/src/cmd/go/testdata/script/gcflags_patterns.txt b/src/cmd/go/testdata/script/gcflags_patterns.txt
index f23cecefd3..e9521c2fb2 100644
--- a/src/cmd/go/testdata/script/gcflags_patterns.txt
+++ b/src/cmd/go/testdata/script/gcflags_patterns.txt
@@ -7,28 +7,28 @@ env GOCACHE=$WORK/gocache # Looking for compile commands, so need a clean cache
# -gcflags=-e applies to named packages, not dependencies
go build -n -v -gcflags=-e z1 z2
-stderr 'compile.* -e.* -p z1'
-stderr 'compile.* -e.* -p z2'
+stderr 'compile.* -p z1.* -e'
+stderr 'compile.* -p z2.* -e'
stderr 'compile.* -p y'
-! stderr 'compile.* -e.* -p [^z]'
+! stderr 'compile.* -p [^z].* -e'
# -gcflags can specify package=flags, and can be repeated; last match wins
go build -n -v -gcflags=-e -gcflags=z1=-N z1 z2
-stderr 'compile.* -N.* -p z1'
-! stderr 'compile.* -e.* -p z1'
-! stderr 'compile.* -N.* -p z2'
-stderr 'compile.* -e.* -p z2'
+stderr 'compile.* -p z1.* -N'
+! stderr 'compile.* -p z1.* -e'
+! stderr 'compile.* -p z2.* -N'
+stderr 'compile.* -p z2.* -e'
stderr 'compile.* -p y'
-! stderr 'compile.* -e.* -p [^z]'
-! stderr 'compile.* -N.* -p [^z]'
+! stderr 'compile.* -p [^z].* -e'
+! stderr 'compile.* -p [^z].* -N'
# -gcflags can have arbitrary spaces around the flags
go build -n -v -gcflags=' z1 = -e ' z1
-stderr 'compile.* -e.* -p z1'
+stderr 'compile.* -p z1.* -e'
# -gcflags='all=-e' should apply to all packages, even with go test
go test -c -n -gcflags='all=-e' z1
-stderr 'compile.* -e.* -p z3 '
+stderr 'compile.* -p z3.* -e '
# this particular -gcflags argument made the compiler crash
! go build -gcflags=-d=ssa/ z1