Skip to content

go: Add first-line pattern detection for executable Go scripts#48913

Merged
ConradIrwin merged 1 commit intozed-industries:mainfrom
dastrobu:feature/go-first-line-comments
Feb 12, 2026
Merged

go: Add first-line pattern detection for executable Go scripts#48913
ConradIrwin merged 1 commit intozed-industries:mainfrom
dastrobu:feature/go-first-line-comments

Conversation

@dastrobu
Copy link
Contributor

Add support for detecting Go files that can be executed directly via shebang-style comments (e.g., '// usr/bin/env go run "$0" "$@"; exit "$?"').

This allows Zed to recognize Go scripts with first-line comments containing 'go run' as executable Go files, similar to how other languages detect shebangs or mode lines.

Reference: https://stackoverflow.com/q/7707178/1458343

Release Notes:

  • Improved: Go language detection now recognizes executable Go scripts with first-line 'go run' comments.

Add support for detecting Go files that can be executed directly via
shebang-style comments (e.g., '// usr/bin/env go run "$0" "$@"; exit "$?"').

This allows Zed to recognize Go scripts with first-line comments
containing 'go run' as executable Go files, similar to how other
languages detect shebangs or mode lines.

Reference: https://stackoverflow.com/q/7707178/1458343

Release Notes:

- Improved: Go language detection now recognizes executable Go scripts with first-line 'go run' comments.
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Feb 11, 2026
@zed-community-bot zed-community-bot bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label Feb 11, 2026
@ConradIrwin ConradIrwin merged commit 4f2a277 into zed-industries:main Feb 12, 2026
51 of 53 checks passed
@ConradIrwin
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants