Closed
Description
Go version
go version go1.24.1 windows/amd64
Output of go env
in your module/workspace:
set AR=ar
set CC=gcc
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_ENABLED=0
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set CXX=g++
set GCCGO=gccgo
set GO111MODULE=on
set GOAMD64=v1
set GOARCH=amd64
set GOAUTH=netrc
set GOBIN=
set GOCACHE=C:\Users\user\AppData\Local\go-build
set GOCACHEPROG=
set GODEBUG=
set GOENV=C:\Users\user\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFIPS140=off
set GOFLAGS=
set GOGCCFLAGS=-m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\user\AppData\Local\Temp\go-build3582125240=/tmp/go-build -gno-record-gcc-switches
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMOD=C:\Users\user\Desktop\path\TestDevel\go.mod
set GOMODCACHE=C:\Users\user\go\pkg\mod
set GONOPROXY=github.com
set GONOSUMDB=github.com
set GOOS=windows
set GOPATH=C:\Users\user\go
set GOPRIVATE=github.com
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:/Users/user/go/go1.24.1
set GOSUMDB=sum.golang.org
set GOTELEMETRY=local
set GOTELEMETRYDIR=C:\Users\user\AppData\Roaming\go\telemetry
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=C:\Users\user\go\go1.24.1\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.24.1
set GOWORK=
set PKG_CONFIG=pkg-config
What did you do?
ReadBuildInfo.Main.Version shows "(devel)" after tagging v2 package as v2.
package main
import (
"fmt"
"runtime/debug"
)
func main() {
info, _ := debug.ReadBuildInfo()
fmt.Println(info.Main)
}
Although my personal case may be different - I'm not 100% sure how I broke this feature in my private repo - the scenario below successfully reproduces the same output, so I think it's still worth reporting.
Thanks to user truck.dad from the Discord Gophers server for his initial support and the Unix PoC!
What did you see happen?
@echo off
git init
go mod edit -module test.module
git add . && git commit -m "test"
git tag v1.2.3
go build .
test.module.exe
del test.module.exe
go mod edit -module test.module/v2
git add . && git commit -m "test"
git tag v2.3.4
go build .
test.module.exe
Initialized empty Git repository in C:/Users/usr/path/TestDevel/.git/
warning: in the working copy of 'go.mod', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'main.go', LF will be replaced by CRLF the next time Git touches it
[master (root-commit) 950c98b] test
7 files changed, 57 insertions(+)
create mode 100644 .gitignore
create mode 100644 TestDevel.iml
create mode 100644 go.mod
create mode 100644 main.go
create mode 100644 test.bat
create mode 100644 test.module.exe
create mode 100644 test.sh
{test.module v1.2.3 <nil>}
warning: in the working copy of 'go.mod', LF will be replaced by CRLF the next time Git touches it
[master 64f3139] test
2 files changed, 1 insertion(+), 1 deletion(-)
delete mode 100644 test.module.exe
{test.module/v2 (devel) <nil>}
What did you expect to see?
{test.module v1.2.3 <nil>}
{test.module/v2 v2.3.4 <nil>}
or pseudoversion, or literally anything other than "(devel)"