Description: Allow setting the version via ldflags Upstream commit 1409e2c (cmd/shfmt: drop support for setting the version via ldflags) dropped support for setting the version via ldflags. The version is now stamped in the binary by go-build(1) based on the tag and/or the commit hash. Since this upstream change breaks `shfmt --version`, let's revert the aforementioned commit. Author: Vincent Blut Forwarded: no Last-Update: 2026-05-14 --- This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ Index: golang-mvdan-sh/cmd/shfmt/main.go =================================================================== --- golang-mvdan-sh.orig/cmd/shfmt/main.go +++ golang-mvdan-sh/cmd/shfmt/main.go @@ -103,6 +103,8 @@ var ( color bool copyBuf = make([]byte, 32*1024) + + version = "(devel)" ) func main() { @@ -153,8 +155,7 @@ For more information and to report bugs, flag.Parse() if versionFlag.val { - version := "(unknown)" - if info, ok := debug.ReadBuildInfo(); ok { + if info, ok := debug.ReadBuildInfo(); ok && version == "(devel)" { mod := &info.Main if mod.Replace != nil { mod = mod.Replace