| Crates.io | gomod-parser |
| lib.rs | gomod-parser |
| version | 0.4.1 |
| created_at | 2024-01-17 21:33:52.986091+00 |
| updated_at | 2025-06-25 11:41:24.970175+00 |
| description | Simple go.mod parser |
| homepage | |
| repository | https://github.com/baz-scm/gomod-parser |
| max_upload_size | |
| id | 1103423 |
| size | 73,688 |
A simple go.mod file parser based on winnow.
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
}]
);