Re: [go-nuts] Parsing go.mod

2019-09-03 Thread James Pettyjohn
Thanks a lot for the tips. This repo is working out and should hold me over, as Ian mentioned, until golang.org/x/mod/modfile is out. On Tuesday, September 3, 2019 at 12:26:28 AM UTC-7, Paul Jolly wrote: > > Also note that you can run: > > go mod edit -json > > and get JSON output. > >

Re: [go-nuts] Parsing go.mod

2019-09-03 Thread James Pettyjohn
That's good news, gives me some confidence that the tooling will keep working after 1.14. On Tuesday, September 3, 2019 at 6:43:15 PM UTC-7, Ian Cottrell wrote: > > The parsing code will eventually be public, see > https://github.com/golang/go/issues/31761 > When it is done, you would want golan

Re: [go-nuts] Parsing go.mod

2019-09-03 Thread 'Ian Cottrell' via golang-nuts
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 wrote: > > So

Re: [go-nuts] Parsing go.mod

2019-09-03 Thread Paul Jolly
> 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 runni

Re: [go-nuts] Parsing go.mod

2019-09-03 Thread Paul Jolly
Also note that you can run: go mod edit -json and get JSON output. go help mod edit will given you the types you can then use to unmarshal the JSON. Failing that, the code that Dan referenced has been factored out into: https://godoc.org/github.com/rogpeppe/go-internal/modfile On

Re: [go-nuts] Parsing go.mod

2019-09-03 Thread James Pettyjohn
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 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, tota

Re: [go-nuts] Parsing go.mod

2019-09-03 Thread James Pettyjohn
Thanks. I saw the same being done by vgo - might be viable. On Monday, September 2, 2019 at 10:52:45 PM UTC-7, kortschak wrote: > > Not really exposed, but there is code you could copy. > > https://golang.org/pkg/cmd/go/internal/modfile/#Parse > > On Mon, 2019-09-02 at 22:44 -0700, James Pettyjo

Re: [go-nuts] Parsing go.mod

2019-09-02 Thread Kurtis Rader
On Mon, Sep 2, 2019 at 10:44 PM James Pettyjohn 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 sh

Re: [go-nuts] Parsing go.mod

2019-09-02 Thread Dan Kortschak
Not really exposed, but there is code you could copy. https://golang.org/pkg/cmd/go/internal/modfile/#Parse On Mon, 2019-09-02 at 22:44 -0700, James Pettyjohn wrote: > Hi, > > 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 p

[go-nuts] Parsing go.mod

2019-09-02 Thread James Pettyjohn
Hi, 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. Is there an exposed package that can be used for this? - J -- You received this message