From 4f2a277a63f7de0b0c364f7e42143af28dd1f9c5 Mon Sep 17 00:00:00 2001 From: Daniel Strobusch <1847260+dastrobu@users.noreply.github.com> Date: Thu, 12 Feb 2026 05:32:22 +0100 Subject: [PATCH] go: Add first-line pattern detection for executable Go scripts (#48913) 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. --- crates/languages/src/go/config.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/languages/src/go/config.toml b/crates/languages/src/go/config.toml index 0a5122c038e1e38e0c963c3d22581f794656c276..c8589b14d68aa66cd189940c65618b7736b4bfd7 100644 --- a/crates/languages/src/go/config.toml +++ b/crates/languages/src/go/config.toml @@ -2,6 +2,7 @@ name = "Go" grammar = "go" path_suffixes = ["go"] line_comments = ["// "] +first_line_pattern = '^//.*\bgo run\b' autoclose_before = ";:.,=}])>" brackets = [ { start = "{", end = "}", close = true, newline = true },