Closed
Description
What version of Go are you using (go version
)?
go version go1.6.3 linux/amd64
Also tested with go version go1.6.3 linux/amd64
What operating system and processor architecture are you using (go env
)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH=""
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT="1"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"
What did you do?
mkdir a%2fb
cd a%2fb
mkdir include
Save this Go program as a%2fb/silly.go
:
package main
// #cgo CFLAGS: -I"${SRCDIR}/include"
import "C"
func main() {
}
What did you expect to see?
Expected successful compilation/execution of the program.
What did you see instead?
# go run silly.go
package main: /somewhere/a%2Fb/silly.go: malformed #cgo argument: -I/somewhere/a%2Fb/include
This happens for CFLAGS
and LDFLAGS
on multiple architectures.
Related to #7906, #16455, #11868, which all discuss spaces in paths; there are issues with other valid path characters as well.
This path was not something I created naturally; it was a side-effect of our CI environment (Jenkins) which occasionally uses paths like foo%2Fbar
if a Git branch has a name "foo/bar". It also can create paths like foo%2Fbar@2
when a second scratch directory is needed.