diff options
author | Ian Lance Taylor <iant@golang.org> | 2018-08-01 11:37:14 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2018-08-01 19:54:32 +0000 |
commit | 3acd2576ab224d905cfd09208a6d6607ce4b0fb6 (patch) | |
tree | 5cd7ae8ed5337a8e74d5b731f656653f8befeb38 | |
parent | 27a9b1bbecc0b1aa02d88128ef36904e6f56ec43 (diff) | |
download | go-3acd2576ab224d905cfd09208a6d6607ce4b0fb6.tar.gz go-3acd2576ab224d905cfd09208a6d6607ce4b0fb6.zip |
go/build: accept ! in cgo arguments
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>
-rw-r--r-- | src/cmd/go/testdata/mod/rsc.io_!c!g!o_v1.0.0.txt | 19 | ||||
-rw-r--r-- | src/cmd/go/testdata/script/mod_case_cgo.txt | 7 | ||||
-rw-r--r-- | src/go/build/build.go | 3 |
3 files changed, 28 insertions, 1 deletions
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 index 0000000000..6276147535 --- /dev/null +++ b/src/cmd/go/testdata/mod/rsc.io_!c!g!o_v1.0.0.txt @@ -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 index 0000000000..a54e8ca803 --- /dev/null +++ b/src/cmd/go/testdata/script/mod_case_cgo.txt @@ -0,0 +1,7 @@ +env GO111MODULE=on + +go get rsc.io/CGO +go build rsc.io/CGO + +-- go.mod -- +module x diff --git a/src/go/build/build.go b/src/go/build/build.go index 0ed5b82fa1..b68a712a7d 100644 --- a/src/go/build/build.go +++ b/src/go/build/build.go @@ -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 == "" { |