gomod-parser2

Crates.iogomod-parser2
lib.rsgomod-parser2
version0.4.2
created_at2025-06-23 23:09:43.324202+00
updated_at2025-09-24 18:45:57.287443+00
descriptionSimple go.mod parser
homepage
repositoryhttps://github.com/baz-scm/gomod-parser
max_upload_size
id1723668
size74,339
Miles Johnson (milesj)

documentation

README

This is a temporary fork! Use the official https://docs.rs/gomod-parser/latest/gomod_parser/ instead.

gomod-parser

Build Status Coverage Status Crate MSRV

A simple go.mod file parser based on winnow.

Example

use gomod_parser::{GoMod, Module, ModuleDependency};
use std::str::FromStr;

let input = r#"
module github.com/example

go 1.21

require golang.org/x/net v0.20.0
"#;

let go_mod = GoMod::from_str(input).unwrap();

assert_eq!(go_mod.module, "github.com/example".to_string());
assert_eq!(go_mod.go, Some("1.21".to_string()));
assert_eq!(
    go_mod.require,
    vec![ModuleDependency {
        module: Module {
            module_path: "golang.org/x/net".to_string(),
            version: "v0.20.0".to_string()
        },
        indirect: false
    }]
);
Commit count: 25

cargo fmt