package main
import (
"fmt"
"os"
)
func main() {
for idx, a := range os.Args {
fmt.Printf("arg[%d]: %s\n", idx, a)
}
}
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAN4yCu8eJhi8PhgXWqh%2Bs%2BNJez1zthaGOMUNAcxTyyqe0nnxNw%40mail.gmail.com.
Ah, bad form posting before I tried it in a plain CMD.EXE context.The args are not transformed running from the vanilla command environment. Guess it's a nasty interaction with MSYS.
$ bash -c 'echo $*' foo foo:bar /bar/baz /x/yfoo:bar /bar/baz /x/y
"For any executable not dependent on msys-1.0.dll, MSYS will convert POSIX paths that are used as arguments to Win32 paths.
$ ldd /usr/bin/bash.exe
ntdll.dll => /c/WINDOWS/SYSTEM32/ntdll.dll (0x7fffed7a0000)
KERNEL32.DLL => /c/WINDOWS/System32/KERNEL32.DLL (0x7fffecc80000)
KERNELBASE.dll => /c/WINDOWS/System32/KERNELBASE.dll (0x7fffeb3b0000)
USER32.dll => /c/WINDOWS/System32/USER32.dll (0x7fffed5c0000)
msys-2.0.dll => /usr/bin/msys-2.0.dll (0x180040000)
win32u.dll => /c/WINDOWS/System32/win32u.dll (0x7fffeb380000)
GDI32.dll => /c/WINDOWS/System32/GDI32.dll (0x7fffebb60000)
gdi32full.dll => /c/WINDOWS/System32/gdi32full.dll (0x7fffea730000)
msvcp_win.dll => /c/WINDOWS/System32/msvcp_win.dll (0x7fffeb6b0000)
ucrtbase.dll => /c/WINDOWS/System32/ucrtbase.dll (0x7fffeb280000)
$ ldd path-quirk # from go build path-quirk.go
ntdll.dll => /c/WINDOWS/SYSTEM32/ntdll.dll (0x7fffed7a0000)
KERNEL32.DLL => /c/WINDOWS/System32/KERNEL32.DLL (0x7fffecc80000)
KERNELBASE.dll => /c/WINDOWS/System32/KERNELBASE.dll (0x7fffeb3b0000)
apphelp.dll => /c/WINDOWS/SYSTEM32/apphelp.dll (0x7fffe87f0000)