1
0
mirror of https://github.com/golang/go synced 2024-11-23 18:30:06 -07:00

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>
This commit is contained in:
Ian Lance Taylor 2018-08-01 11:37:14 -07:00
parent 27a9b1bbec
commit 3acd2576ab
3 changed files with 28 additions and 1 deletions

View File

@ -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

View File

@ -0,0 +1,7 @@
env GO111MODULE=on
go get rsc.io/CGO
go build rsc.io/CGO
-- go.mod --
module x

View 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 == "" {