Categorygithub.com/cloudingcity/gomod
repositorypackage
1.0.1
Repository: https://github.com/cloudingcity/gomod.git
Documentation: pkg.go.dev

# README

Gomod

Build Status codecov

Parse go.mod into a struct

Install

go get -u github.com/cloudingcity/gomod

Example

package main

import (
	"fmt"
	"io/ioutil"

	"github.com/cloudingcity/gomod"
)

func main() {
	file, err := ioutil.ReadFile("../go.mod")
	if err != nil {
		panic(err)
	}

	mod, err := gomod.Parse(file)
	if err != nil {
		panic(err)
	}

	fmt.Printf("%+v", mod)
	// type GoMod struct {
	//  	Module  Module
	//  	Go      string
	//  	Require []Require
	//  	Exclude []Module
	//  	Replace []Replace
	// }
}