You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ cat x.go
package main
import (
"fmt"
"os"
)
func main() {
fmt.Printf("%q\n", os.Args)
}
$ go run x.go a b "c d"
["/var/folders/n7/gw0f1vrj0m5ffgwgyzbm2fwm001w6m/T/go-build004220194/command-line-arguments/_obj/exe/x" "a" "b" "c" "d"]
Note that c and d are split into two arguments.
Using go build + ./x a b "c d" works as expected, so the problem is with go run somewhere.
$ go run issue10761.go a b "c d"
["/var/folders/p6/9tyrs0yx74l6t96y2rsq07300000gn/T/go-build212843169/command-line arguments/_obj/exe/issue10761" "a" "b" "c d"]
$ go version
go version devel +82359d1 Sat May 9 02:58:50 2015 +0000 darwin/amd64
My first mistake was in run.bash, fixed by https://go-review.googlesource.com/#/c/9892/.
My second mistake (the same mistake) was /home/bradfitz/bin/go (first in my $PATH for "go") which was:
$ cat ~/bin/go
#!/bin/shexec$GOROOT/bin/go $@
... which I forgot I even had.
I never knew about this bash/shell "$@" "feature" until today.
Note that
c
andd
are split into two arguments.Using
go build
+./x a b "c d"
works as expected, so the problem is withgo run
somewhere.(noticed with @robpike and @randall77)
The text was updated successfully, but these errors were encountered: