Skip to main content

impactsense_parser/
go_stdlib.rs

1//! Go standard-library import paths (from `go list std` at embed time).
2use std::collections::HashSet;
3use std::sync::OnceLock;
4
5fn stdlib_paths() -> &'static HashSet<String> {
6    static SET: OnceLock<HashSet<String>> = OnceLock::new();
7    SET.get_or_init(|| {
8        include_str!("go_stdlib_paths.txt")
9            .lines()
10            .map(|l| l.trim().to_string())
11            .filter(|l| !l.is_empty())
12            .collect()
13    })
14}
15
16pub fn is_go_stdlib_import(import_path: &str) -> bool {
17    stdlib_paths().contains(import_path.trim())
18}