Dominik Schulz 21687eea47
[fix] Fix debug.ModuleVersion (#3079)
* [fix] Fix debug.ModuleVersion

Add tests, fix parsing issues and add a specical case for the main
module.

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* Fix two lint issues

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

---------

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2025-03-05 16:54:17 +01:00

30 lines
624 B
Go

// modinfo a small helper to print the build info and module versions.
//
// Test builds don't have build info, so this will only work in a real build.
package main
import (
"fmt"
rd "runtime/debug"
_ "github.com/blang/semver/v4"
"github.com/gopasspw/gopass/pkg/debug"
)
func main() {
info, ok := rd.ReadBuildInfo()
if !ok {
panic("could not read build info")
}
fmt.Printf("Build Info: %+v\n", info)
for _, v := range []string{
"github.com/blang/semver/v4",
"github.com/gopasspw/gopass/internal/backend/storage/fs",
} {
mv := debug.ModuleVersion(v)
fmt.Printf("Module Version: %s %s\n", v, mv)
}
}