Bug 2160825 - `go version -m` missing module version information
Summary: `go version -m` missing module version information
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: golang
Version: 38
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Alejandro Sáez Morollón
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-01-13 20:52 UTC by M Hickford
Modified: 2023-02-07 15:05 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description M Hickford 2023-01-13 20:52:13 UTC
`go version -m` prints "Go version and module versions used to build a specific executable"

Example from the Go docs https://go.dev/ref/mod#go-version-m

> The -m flag causes go version to print each executable’s embedded module version information, when available. For each executable, go version -m prints a table with tab-separated columns like the one below.
>
> $ go version -m ~/go/bin/goimports
> /home/jrgopher/go/bin/goimports: go1.14.3
>        path    golang.org/x/tools/cmd/goimports
>        mod     golang.org/x/tools      v0.0.0-20200518203908-8018eb2c26ba      h1:0Lcy64USfQQL6GAJma8BdHCgeofcchQj+Z7j0SXYAzU=
>        dep     golang.org/x/mod        v0.2.0          h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ=
>        dep     golang.org/x/xerrors    v0.0.0-20191204190536-9bdfabe68543      h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=

However this information seems to be missing in Fedora go binaries:

$ go version -m /usr/bin/caddy
caddy: go1.19
        path    github.com/caddyserver/caddy/cmd/caddy
        build   -compiler=gc
        build   -ldflags=" -X github.com/caddyserver/caddy/version=2.5.2 -B 0x5ed1393cc60665b6fd18eda730da04e78c91ee51 -compressdwarf=false -linkmode=external -extldflags '-Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -Wl,-dT,/builddir/build/BUILD/caddy-2.5.2/.package_note-caddy-2.5.2-1.fc37.x86_64.ld '"
        build   -tags=rpm_crashtraceback
        build   CGO_ENABLED=1
        build   CGO_CFLAGS=
        build   CGO_CPPFLAGS=
        build   CGO_CXXFLAGS=
        build   CGO_LDFLAGS=
        build   GOARCH=amd64
        build   GOOS=linux
        build   GOAMD64=v1

Presumably the module version information is stripped by some build flag. Could it be added back? Or would it add too much to binary size?

Comment 2 Maxwell G 2023-01-13 22:16:46 UTC
This is probably because we build in GOPATH mode and don't use Go
Modules.

Comment 3 Ben Cotton 2023-02-07 15:05:23 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 38 development cycle.
Changing version to 38.


Note You need to log in before you can comment on or make changes to this bug.