Expected Behavior
A GoFrameworkAdapter base class exists at
nuguard/sbom/adapters/go/_go_base.py that all Go framework adapters subclass,
providing Go-appropriate can_handle() semantics and shared helper methods —
analogous to TSFrameworkAdapter in
nuguard/sbom/adapters/typescript/_ts_regex.py.
Current Behavior
No Go adapter base class exists. If individual Go adapters were written without
a shared base, they would each re-implement can_handle() logic and helper
utilities, diverging from the Python/TypeScript pattern and making maintenance
harder.
Possible Solution
Create nuguard/sbom/adapters/go/_go_base.py:
- Define
GoFrameworkAdapter(FrameworkAdapter) — subclass of the shared
FrameworkAdapter from nuguard/sbom/adapters/base.py. All shared
fields (ComponentDetection, RelationshipHint, _framework_node(),
priority, name) are inherited unchanged.
- Override
can_handle() to use substring/prefix matching against full Go
module paths (e.g. "github.com/tmc/langchaingo" in mod), mirroring the
substring matching that TSFrameworkAdapter.can_handle() uses for scoped
npm packages.
- Port the shared helpers from
TSFrameworkAdapter (_resolve(), _clean(),
_fw_node(), _template_vars()) so all Go adapters get the same toolkit
without duplication.
extract() contract: receives GoParseResult as parse_result.
Steps to Reproduce (for bugs)
N/A — this is a feature addition.
Context
Part of #172 (Add Golang Support to NuGuard Pipeline).
Depends on sub-issues 1 and 2.
Blocking: all individual Go framework adapter sub-issues.
Expected Behavior
A
GoFrameworkAdapterbase class exists atnuguard/sbom/adapters/go/_go_base.pythat all Go framework adapters subclass,providing Go-appropriate
can_handle()semantics and shared helper methods —analogous to
TSFrameworkAdapterinnuguard/sbom/adapters/typescript/_ts_regex.py.Current Behavior
No Go adapter base class exists. If individual Go adapters were written without
a shared base, they would each re-implement
can_handle()logic and helperutilities, diverging from the Python/TypeScript pattern and making maintenance
harder.
Possible Solution
Create
nuguard/sbom/adapters/go/_go_base.py:GoFrameworkAdapter(FrameworkAdapter)— subclass of the sharedFrameworkAdapterfromnuguard/sbom/adapters/base.py. All sharedfields (
ComponentDetection,RelationshipHint,_framework_node(),priority,name) are inherited unchanged.can_handle()to use substring/prefix matching against full Gomodule paths (e.g.
"github.com/tmc/langchaingo" in mod), mirroring thesubstring matching that
TSFrameworkAdapter.can_handle()uses for scopednpm packages.
TSFrameworkAdapter(_resolve(),_clean(),_fw_node(),_template_vars()) so all Go adapters get the same toolkitwithout duplication.
extract()contract: receivesGoParseResultasparse_result.Steps to Reproduce (for bugs)
N/A — this is a feature addition.
Context
Part of #172 (Add Golang Support to NuGuard Pipeline).
Depends on sub-issues 1 and 2.
Blocking: all individual Go framework adapter sub-issues.