Skip to content
This repository was archived by the owner on Jun 17, 2026. It is now read-only.

feat: Add Go module (go.mod + go.sum) parser - #3

Merged
yufeiminds merged 3 commits into
mainfrom
copilot/add-go-package-supports
Apr 15, 2026
Merged

yufeiminds merged 3 commits into
mainfrom
copilot/add-go-package-supports

Conversation

Copilot AI commented Apr 15, 2026 •

Copy link
Copy Markdown

Adds first-class Go project support to the SBOM library, enabling dependency extraction from go.mod and checksum resolution from go.sum.

New: src/packages/go

  • Line-oriented go.mod parser: module, go version, multi-line require (...) blocks, single-line require, // indirect annotations
  • go.sum parser: extracts h1: checksums keyed by module@version, skips /go.mod-only entries
  • Module path splitting into namespace/name for correct PURL generation (e.g. github.com/google/uuid → pkg:golang/github.com/google/uuid@v1.3.0)

Updated: src/lib

  • New scan_go(root_path, go_mod_content, go_sum_content?) public API
  • scan_all / parse_discovered_project now handles ProjectType::Go — reads go.mod + optional go.sum from the virtual filesystem

Usage

let project = scan_go(
  "myservice/",
  go_mod_content,
  Some(go_sum_content),
)
let spdx_json = project_to_spdx(project)

Auto-discovery via scan_all also works — any directory containing a go.mod is detected and parsed automatically.

Copilot AI linked an issue Apr 15, 2026 that may be closed by this pull request
Copilot AI and others added 2 commits April 15, 2026 10:20
Agent-Logs-Url: https://github.com/cogna-dev/sbom/sessions/15d28f56-133d-4893-8f72-e437635246d7

Co-authored-by: yufeiminds <9150374+yufeiminds@users.noreply.github.com>
Agent-Logs-Url: https://github.com/cogna-dev/sbom/sessions/15d28f56-133d-4893-8f72-e437635246d7

Co-authored-by: yufeiminds <9150374+yufeiminds@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for Go packages feat: Add Go module (go.mod + go.sum) parser Apr 15, 2026
Copilot AI requested a review from yufeiminds April 15, 2026 10:24
@yufeiminds
yufeiminds marked this pull request as ready for review April 15, 2026 10:35
@yufeiminds
yufeiminds merged commit 1ddb9f9 into main Apr 15, 2026
0 of 2 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Add go package supports

2 participants