The parsing code will eventually be public, see https://github.com/golang/go/issues/31761 When it is done, you would want golang.org/x/mod/modfile, which will be a (possibly modified) copy of the compiler internal package of the same name.
On Tue, Sep 3, 2019 at 3:29 AM Paul Jolly <p...@myitcv.io> wrote: > > Sorry I left out the details. So far it's two specific properties I need > for instructions in my build process: > > > > 1) The full name of the package > > go list -f {{.Name}} example.com/blah > > > 2) The version of the protobuf dependency for locking the right version > protoc-gen-go before running protoc (that has been asked quite a few times, > total hack, but works). > > go list -f {{.Version}} -m example.com/blah > > Note that if you have a replace directive for example.com/blah then > the replace target might have a version. > > For more detail on either of the above see: > > go help list > > > > > Best, > > James > > > > On Monday, September 2, 2019 at 10:58:53 PM UTC-7, Kurtis Rader wrote: > >> > >> On Mon, Sep 2, 2019 at 10:44 PM James Pettyjohn <japet...@gmail.com> > wrote: > >>> > >>> This might be a bad idea but I'm trying to parse the go.mod file for > data as part of my build process - if at all possible I'd like to avoid > duplicating the data that is already there in another file. > >> > >> > >> In this type of situation you should explain why you need to parse a > go.mod file. Especially since you seem to be asking something not already > asked a thousand times. It is possible, perhaps likely, the reason you want > to do this can be solved some other way. > >> > >> -- > >> Kurtis Rader > >> Caretaker of the exceptional canines Junior and Hank > > > > -- > > 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. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/8b716cac-0eb6-4e95-bdde-12ee832e06a4%40googlegroups.com > . > > -- > 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. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/CACoUkn4MouSb-spFS-NvdYZdC827%2Bx28pXLD0ABd%3D52AHBvfaw%40mail.gmail.com > . > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAA%3DsxTge8ro7tFZvGxyOShKQ5278ky30z7ySyr53eeFGG1eqKA%40mail.gmail.com.