yvbolt/versions.go

34 lines
447 B
Go
Raw Normal View History

2024-06-27 23:01:34 +00:00
package main
import (
"embed"
"golang.org/x/mod/modfile"
)
//go:embed go.mod
var module embed.FS
var (
version_Pebble string
)
func init() {
content, err := module.ReadFile("go.mod")
if err != nil {
panic(err)
}
mm, err := modfile.Parse("", content, nil)
if err != nil {
panic(err)
}
for _, dep := range mm.Require {
switch dep.Mod.Path {
case "github.com/cockroachdb/pebble":
version_Pebble = dep.Mod.Version
}
}
}