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 Tue, 3 Sep 2019 at 08:21, James Pettyjohn <japettyj...@gmail.com> wrote:
>
> 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 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 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 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/7a06f505-187e-473f-b748-a8bf7f114bf6%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/CACoUkn5xz0Hjew_RuJHTeah%3DyJVr56sS55ym6rDaFfABBFAOAA%40mail.gmail.com.

Reply via email to