Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/edwin-luijten/go_mod_parser

Parse go.mod files into structs, this module is extracted from https://github.com/golang/vgo/tree/master/vendor/cmd/go/internal/modfile
https://github.com/edwin-luijten/go_mod_parser

Last synced: 1 day ago
JSON representation

Parse go.mod files into structs, this module is extracted from https://github.com/golang/vgo/tree/master/vendor/cmd/go/internal/modfile

Awesome Lists containing this project

README

        

# GO mod parser

This module is extracted from https://github.com/golang/vgo/tree/master/vendor/cmd/go/internal/modfile

## Installation
``` go get github.com/edwin-luijten/go_mod_parser ```

## Usage

```go
package my_package

import (
"github.com/edwin-luijten/go_mod_parser"
"io/ioutil"
"fmt"
)

func main() {
contents, _ := ioutil.ReadFile("./go.mod")

p, err := go_mod_parser.Parse("go.mod", contents, nil)
if err != nil {
panic(err)
}

fmt.Println(p.Module.Mod.Path)
}
```