Skip to content

feat: add go ecosystem support to generate lockfile (Fixes #28) - #33

Open
anant-shipit wants to merge 1 commit into
aboutcode-org:mainfrom
anant-shipit:feat/issue-28-go-lockfile
Open

feat: add go ecosystem support to generate lockfile (Fixes #28)#33
anant-shipit wants to merge 1 commit into
aboutcode-org:mainfrom
anant-shipit:feat/issue-28-go-lockfile

Conversation

@anant-shipit

Copy link
Copy Markdown

Fixes #28

Description

This PR adds support for generating an accurate Go "lockfile" (go.list.json) using the deplock CLI tool.

As noted in the issue, go.mod and go.sum do not always tell the complete story of the exact dependencies used during a build (for example, they often hide deep transitive dependencies).

To resolve this and get the most accurate details, the new deplock go [path] command leverages the go list -m -json all command, which outputs the fully resolved build graph.

Implementation Details

  • Added cmd/go.go to handle the Go ecosystem.
  • go list -m -json all natively outputs a stream of Newline-Delimited JSON (NDJSON) rather than a valid JSON array. The command intercepts this raw stdout stream, parses the NDJSON, and wraps it in standard brackets to output a strictly valid JSON Array to go.list.json.
  • Registered goCmd into the global ecosystems array in cmd/root.go.

Verification

  • Tested locally by running deplock go . on the dependency-inspector project itself.
  • Verified that go.list.json is generated successfully and passes strict JSON validation.
  • Confirmed that the output correctly surfaces hidden transitive dependencies that were not explicitly listed in the raw go.mod file.

…outcode-org#28)

Signed-off-by: anant-shipit <anantsinghrathore97@gmail.com>
@anant-shipit
anant-shipit force-pushed the feat/issue-28-go-lockfile branch from 9153b20 to 51c2202 Compare July 20, 2026 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create "lockfile" for Go

1 participant