Closed
Description
What version of Go are you using (go version
)?
$ go version go version go1.15.3 darwin/amd64
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (go env
)?
darwin
What did you do?
I build with the following command,
go build -v -ldflags "-X 'qiniu.com/kodotest.regionNb=\'a very long string.....which contains \n characters.....\''"
get go link
error.
Then I change the above command with a shorter one,
go build -v -ldflags "-X 'qiniu.com/kodotest.regionNb=\'a short string.....which contains \n characters.....\''"
no go link
error this time.
What did you expect to see?
No go link
error if I pass a very long args with \n
character inside.
My analysis
go1.14 and go1.13 have no such issue.
I notice that go has introduced response file to pass long args in Windows: https://go-review.googlesource.com/c/go/+/110395/7/src/cmd/go/internal/work/exec.go#2483
and enabled it for other OS in go1.15:
go/src/cmd/go/internal/work/exec.go
Line 3131 in f7e2646
response file use \n
to separate args will cause this issue.