`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?
On Fri, Jan 13, 2023 at 8:55 PM M Hickford matthickford@fedoraproject.org wrote:
`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?
Off the top of my head, I'm not quite sure why this happens. Can you fill a bug so I can track this properly? You can reach bugzilla from the Issue tab here https://src.fedoraproject.org/rpms/golang If you don't have a Bugzilla account, I can do it for you.
Thanks for bringing this up!
golang mailing list -- golang@lists.fedoraproject.org To unsubscribe send an email to golang-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/golang@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
Thanks Alejandro for your reply. Opened https://bugzilla.redhat.com/show_bug.cgi?id=2160825
On Fri, Jan 13, 2023 at 9:18 PM Alejandro Saez Morollon asm@redhat.com wrote:
On Fri, Jan 13, 2023 at 8:55 PM M Hickford matthickford@fedoraproject.org wrote:
`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?
Off the top of my head, I'm not quite sure why this happens. Can you fill a bug so I can track this properly? You can reach bugzilla from the Issue tab here https://src.fedoraproject.org/rpms/golang If you don't have a Bugzilla account, I can do it for you.
Thanks for bringing this up!
I'm pretty sure this is because go binaries in Fedora are not actually built in "module" mode, but instead explicitly turn it off by exporting the "GO111MODULE=off" environment variable - because go packaging doesn't yet support building with "modules".
Fabio
golang@lists.fedoraproject.org