diff --git a/main.go b/main.go
index 6ef2dc50c1..0083d75a3b 100644
--- a/main.go
+++ b/main.go
@@ -823,6 +823,7 @@
 		mod = mod.Replace
 	}
 
+	mod.Version = "@version@"
 	fmt.Fprintf(w, "%s %s\n\n", mod.Path, mod.Version)
 	fmt.Fprintf(w, "Build settings:\n")
 	for _, setting := range info.Settings {
diff --git a/testdata/script/help.txtar b/testdata/script/help.txtar
index 8e4eb39a53..ddc48f59b0 100644
--- a/testdata/script/help.txtar
+++ b/testdata/script/help.txtar
@@ -88,7 +88,7 @@
 # Test the version command. Note that test binaries exclude VCS build info,
 # and we reuse the test binary for garble itself, so that's missing.
 exec garble version
-stdout -count=1 'mvdan.cc/garble \(devel\)'
+stdout -count=1 'mvdan.cc/garble @version@'
 stdout -count=1 'Build settings'
 stdout -count=3 '-compiler|GOOS|GOARCH'
 ! stdout 'vcs'
