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 } } }