]> Cypherpunks repositories - gostls13.git/commitdiff
go/build: accept ! in cgo arguments
authorIan Lance Taylor <iant@golang.org>
Wed, 1 Aug 2018 18:37:14 +0000 (11:37 -0700)
committerIan Lance Taylor <iant@golang.org>
Wed, 1 Aug 2018 19:54:32 +0000 (19:54 +0000)
The ! can show up when using ${SRCDIR} with uppercase letters in module names.

Fixes #26716

Change-Id: Ia474ed8ec40a88076e8aac21103f6c7bb3848bdb
Reviewed-on: https://go-review.googlesource.com/127297
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/go/testdata/mod/rsc.io_!c!g!o_v1.0.0.txt [new file with mode: 0644]
src/cmd/go/testdata/script/mod_case_cgo.txt [new file with mode: 0644]
src/go/build/build.go

diff --git a/src/cmd/go/testdata/mod/rsc.io_!c!g!o_v1.0.0.txt b/src/cmd/go/testdata/mod/rsc.io_!c!g!o_v1.0.0.txt
new file mode 100644 (file)
index 0000000..6276147
--- /dev/null
@@ -0,0 +1,19 @@
+rsc.io/CGO v1.0.0
+
+-- .mod --
+module rsc.io/CGO
+-- .info --
+{"Version":"v1.0.0","Name":"","Short":"","Time":"2018-08-01T18:23:45Z"}
+-- go.mod --
+module rsc.io/CGO
+-- cgo.go --
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package CGO
+
+// #cgo CFLAGS: -I${SRCDIR}
+import "C"
+
+var V = 0
diff --git a/src/cmd/go/testdata/script/mod_case_cgo.txt b/src/cmd/go/testdata/script/mod_case_cgo.txt
new file mode 100644 (file)
index 0000000..a54e8ca
--- /dev/null
@@ -0,0 +1,7 @@
+env GO111MODULE=on
+
+go get rsc.io/CGO
+go build rsc.io/CGO
+
+-- go.mod --
+module x
index 0ed5b82fa17e6fea63f4a446a8c4c05257096454..b68a712a7daba2413c28da94e15457ba19cbae36 100644 (file)
@@ -1505,7 +1505,8 @@ func (ctxt *Context) makePathsAbsolute(args []string, srcDir string) {
 // See golang.org/issue/6038.
 // The @ is for OS X. See golang.org/issue/13720.
 // The % is for Jenkins. See golang.org/issue/16959.
-const safeString = "+-.,/0123456789=ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz:$@% "
+// The ! is because module paths may use them. See golang.org/issue/26716.
+const safeString = "+-.,/0123456789=ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz:$@%! "
 
 func safeCgoName(s string) bool {
        if s == "" {