Skip to content
This repository has been archived by the owner on May 29, 2020. It is now read-only.

uudashr/go-module

Repository files navigation

⛔ [DEPRECATED] This project is no longer maintained. Use official module golang.org/x/mod, link https://pkg.go.dev/golang.org/x/mod


Build Status GoDoc

go-module

This are project for fun. Parse and read go module. Read go module

Usage

Install go get -u github.com/uudashr/go-module

Example

Given go.mod file

module my/thing
require other/thing v1.0.2
require new/thing v2.3.4
exclude old/thing v1.2.3
replace bad/thing v1.4.5 => good/thing v1.4.5
package main

import module "github.com/uudashr/go-module"

func main() {
    b, err := ioutil.ReadFile("go.mod")
    if err != nil {
        panic(err)
    }
    
    mod, err := module.Parse(string(b))
    if err != nil {
        panic(err)
    }
    
    _ = mod // now we have mod file
    // mod.Requires
    // mod.Excludes
    // mod.Repalces
}

About

Go module file parsing

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published