Skip to content

Commit 3acd257

Browse files
go/build: accept ! in cgo arguments
The ! can show up when using ${SRCDIR} with uppercase letters in module names. Fixes golang#26716 Change-Id: Ia474ed8ec40a88076e8aac21103f6c7bb3848bdb Reviewed-on: https://go-review.googlesource.com/127297 Run-TryBot: Ian Lance Taylor <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent 27a9b1b commit 3acd257

3 files changed

Lines changed: 28 additions & 1 deletion

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
rsc.io/CGO v1.0.0
2+
3+
-- .mod --
4+
module rsc.io/CGO
5+
-- .info --
6+
{"Version":"v1.0.0","Name":"","Short":"","Time":"2018-08-01T18:23:45Z"}
7+
-- go.mod --
8+
module rsc.io/CGO
9+
-- cgo.go --
10+
// Copyright 2018 The Go Authors. All rights reserved.
11+
// Use of this source code is governed by a BSD-style
12+
// license that can be found in the LICENSE file.
13+
14+
package CGO
15+
16+
// #cgo CFLAGS: -I${SRCDIR}
17+
import "C"
18+
19+
var V = 0
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
env GO111MODULE=on
2+
3+
go get rsc.io/CGO
4+
go build rsc.io/CGO
5+
6+
-- go.mod --
7+
module x

src/go/build/build.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1505,7 +1505,8 @@ func (ctxt *Context) makePathsAbsolute(args []string, srcDir string) {
15051505
// See golang.org/issue/6038.
15061506
// The @ is for OS X. See golang.org/issue/13720.
15071507
// The % is for Jenkins. See golang.org/issue/16959.
1508-
const safeString = "+-.,/0123456789=ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz:$@% "
1508+
// The ! is because module paths may use them. See golang.org/issue/26716.
1509+
const safeString = "+-.,/0123456789=ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz:$@%! "
15091510

15101511
func safeCgoName(s string) bool {
15111512
if s == "" {

0 commit comments

Comments
 (0)