Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

zsh sqlcmd completion is broken

Open
#750 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
70/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
go, zsh
Domain
cli

Research direction

Reproduce the failure with sqlcmd __complete '' and sqlcmd __complete conf, then read the completion argument path in cmd/sqlcmd/sqlcmd.go around lines 289, 319, 362, and 375, along with cmd/modern/main.go:52. Done means zsh completion for sqlcmd produces suggestions for commands and an empty prompt without panicking.

Written by the indexing model from the issue text.

Description

Installed sqlcmd on MacOS with HomeBrew. After rebuilding ~/.zcompdump the command shows up fine:

% cat ~/.zcompdump | rg sqlcmd
'sqlcmd' '_sqlcmd'

However, trying to autocomplete commands like sqlcmd conf<TAB> or plain sqlcmd <TAB> does nothing.

Looks like there's a real problem there:

~ % sqlcmd __complete ''
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/microsoft/go-sqlcmd/cmd/sqlcmd.isFlag(...)
        github.com/microsoft/go-sqlcmd/cmd/sqlcmd/sqlcmd.go:375
github.com/microsoft/go-sqlcmd/cmd/sqlcmd.checkDefaultValue({0x13c831621600, 0x2, 0x13c8317add88?}, 0x1)
        github.com/microsoft/go-sqlcmd/cmd/sqlcmd/sqlcmd.go:362 +0x2b8
github.com/microsoft/go-sqlcmd/cmd/sqlcmd.convertOsArgs({0x13c8312b6310?, 0x101b82380?, 0x100e1cb4b?})
        github.com/microsoft/go-sqlcmd/cmd/sqlcmd/sqlcmd.go:319 +0x1f0
github.com/microsoft/go-sqlcmd/cmd/sqlcmd.Execute({0x1010ea180, 0x6})
        github.com/microsoft/go-sqlcmd/cmd/sqlcmd/sqlcmd.go:289 +0x148
main.main()
        github.com/microsoft/go-sqlcmd/cmd/modern/main.go:52 +0x1b4

~ % sqlcmd __complete conf
:0
Completion ended with directive: ShellCompDirectiveDefault

Version: sqlcmd ✔: stable 1.10.0 (bottled)

Dominant language
Go
Stars
595
Forks
91
Avg merge
9h 35m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/go-sqlcmd

All issues in microsoft/go-sqlcmd

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.