pub fn parse_go_sum(content: &str) -> ResolvedPackagesExpand description
Parses go.sum content and returns resolved packages.
Filters out /go.mod entries (module file checksums) and only processes
module content checksums (lines with h1: hashes).
When a module appears multiple times with different versions, the last occurrence is used. Go’s go.sum file typically has older versions first (from when they were initially added) and newer versions appended later (after upgrades). The last version represents the current state.
§Arguments
content- The go.sum file content
§Returns
A collection of resolved packages with their versions
§Examples
use deps_go::lockfile::parse_go_sum;
let content = r#"
github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg=
github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL9t9/HBtKc7e/Q7Nb2nqKqTW8mHZy6E7k8m4dLvs=
"#;
let packages = parse_go_sum(content);
assert_eq!(packages.get_version("github.com/gin-gonic/gin"), Some("v1.9.1"));