Ha! Yes, that looks exactly like what I needed. Thanks for the tip! -Max
On Mon, Jan 21, 2019 at 11:44 AM roger peppe <rogpe...@gmail.com> wrote: > > Perhaps you were looking for this, which will be available in the upcoming > go1.12 release? > > https://tip.golang.org/pkg/runtime/debug/#ReadBuildInfo > > On Mon, 21 Jan 2019 at 02:50, Maxim Khitrov <m...@mxcrypt.com> wrote: >> >> I was working on a tool that needed to know the file system paths and >> version information of some of its dependencies from go.mod for code >> generation. I couldn't find any official way of obtaining these >> (debug/gosym was close, but didn't work for the current binary on any >> OS), so I wrote this package: >> >> https://github.com/mxk/go-gomod >> >> It's basically a hack that looks through all file name strings used >> for stack traces in the current binary, identifies those containing >> "@v", and extracts root directory and version information from there. >> >> This got me thinking whether there should be a more general (and >> unsafe-free) way of obtaining module information at run time. 'go >> list' command defines a Module struct containing pretty much all >> information one might want. Would it make sense to compile this >> metadata into the binary (if not already done) and expose it via the >> runtime package? >> >> -Max >> >> -- >> You received this message because you are subscribed to the Google Groups >> "golang-nuts" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to golang-nuts+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.