@JyotikaGargg and I found this issue in main.go where we read the 2nd argument even if os.Args contains just 1 argument i.e. when no argument is specified to sqlcmd.exe
if len(os.Args) > 0 {
if rootCmd.IsValidSubCommand(os.Args[1]) {
isNewCliCommand = true
}
}
\go-sqlcmd\cmd\modern>go build -o sqlcmd.exe
\go-sqlcmd\cmd\modern>.\sqlcmd.exe
panic: runtime error: index out of range [1] with length 1
goroutine 1 [running]:
main.isFirstArgModernCliSubCommand(...)
C:/Users/apdeshmukh/git/go-sqlcmd/cmd/modern/main.go:53
main.main()
C:/Users/apdeshmukh/git/go-sqlcmd/cmd/modern/main.go:41 +0x245
@JyotikaGargg and I found this issue in main.go where we read the 2nd argument even if os.Args contains just 1 argument i.e. when no argument is specified to sqlcmd.exe