Repository navigation
Commit 5cb90f6
committed
fix(extract): drop cgo's
`import "C"` is not an import: "C" is reserved by go/build and no package
with that path can exist — it only tells the toolchain to compile the
preceding comment as C. cbm emitted it as an ordinary import, so the
import resolver fell through to its symbol-name fallback
(cbm_pipeline_resolve_import_node Strategy 3, pass_pkgmap.c), matched the
literal name "C" against every project node called C, and picked the
lexicographically smallest one.
Measured on a real Go+C repo: all 27 files carrying `import "C"` pointed
their IMPORTS edge at the same unrelated `C` member of a test helper —
27 false edges, and 27 files whose import map named a package that does
not exist.
Skip the spec in parse_go_import_spec. Node counts are unchanged and the
file's real imports are untouched; only the false edge disappears (a
3-file fixture goes 22 edges -> 21, 14 nodes -> 14; the real repo goes
27 -> 0 such edges).
Reproduce-first: go_cgo_pseudo_import_dropped is RED without the
extractor change (the "C" import is still in imports[]) and GREEN with
it, while still asserting the file's real `fmt` import survives.
Signed-off-by: Ilya Brykau <ilya.brykau@orca.security>import "C" pseudo-package1 parent 5fbab7b commit 5cb90f6
2 files changed
Lines changed: 33 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
136 | 149 | | |
137 | 150 | | |
138 | 151 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3015 | 3015 | | |
3016 | 3016 | | |
3017 | 3017 | | |
| 3018 | + | |
| 3019 | + | |
| 3020 | + | |
| 3021 | + | |
| 3022 | + | |
| 3023 | + | |
| 3024 | + | |
| 3025 | + | |
| 3026 | + | |
| 3027 | + | |
| 3028 | + | |
| 3029 | + | |
| 3030 | + | |
| 3031 | + | |
| 3032 | + | |
| 3033 | + | |
| 3034 | + | |
| 3035 | + | |
| 3036 | + | |
3018 | 3037 | | |
3019 | 3038 | | |
3020 | 3039 | | |
| |||
6752 | 6771 | | |
6753 | 6772 | | |
6754 | 6773 | | |
| 6774 | + | |
6755 | 6775 | | |
6756 | 6776 | | |
6757 | 6777 | | |
| |||
0 commit comments