Repository navigation
Discussion: split go-glx into its own Go module so library consumers don't inherit CLI dependencies #1408
Copy link
Copy link
Open
Open
Discussion: split go-glx into its own Go module so library consumers don't inherit CLI dependencies#1408
Discussion
Copy link
Labels
goPull requests that update go codePull requests that update go codego-glxCore Go library (go-glx package)Core Go library (go-glx package)needs-triageIssue intake couldn't classify the Area — maintainer triage requiredIssue intake couldn't classify the Area — maintainer triage requiredtoolingInfrastructure, workflow, and developer toolsInfrastructure, workflow, and developer tools
Description
Problem
go-glx is the core library, and ADR-0006 keeps it free of I/O so other programs can embed it. But it shares one module with the CLI (go.mod at the repo root). Every program that imports github.com/genealogix/glx/go-glx therefore inherits:
- the root
godirective (nowgo 1.27.2after chore: Move to maintained YAML module and tighten go.mod floor #1407), and - the CLI-only requirements in its module graph and
go.sum: go-git and its ssh/crypto/transport tree (ProtonMail/go-crypto,circl,x/crypto,x/net,knownhosts,ssh_config,ssh-agent, …), cobra, and so on.
None of that is compiled into a program that uses only go-glx, but it does show up in that program's dependency review, its vulnerability scanner output (e.g. GO-2026-5932) and its license audit.
Why a plain go-glx/go.mod is not enough
specification/jsonld.go-glx/jsonld_export.goimportsgithub.com/genealogix/glx/specification/jsonld, which embedsglx-context.jsonldand lives in the root module. A separatego-glxmodule would have to require the root module, which pulls the CLI requirements straight back in.go:embedcannot reach outside a module's directory, so the context file would have to be duplicated intogo-glx/, either by hand plus a drift check, or generated (go generate+ CI diff), orspecification/would have to become a module of its own.- gofakeit.
go-glx/datagen.gousesgithub.com/brianvoe/gofakeit/v7outside test code, so it would stay a library dependency. Options: move the data generator intoglx/(or an internal package), or accept the dependency. - Release tagging. A nested module is versioned by
go-glx/vX.Y.Ztags. The release workflow, goreleaser, docs and CHANGELOG would need to cover a second tag stream, and contributors would need ago.work(or areplacethat must never be released) to develop across both modules.
Options
- A. Split. Create
go-glx/go.mod, move or generate the JSON-LD context inside it, relocatedatagen.go, and addgo-glx/v*tagging to the release process. The library gets its owngofloor and a minimal dependency graph. - B. Stay single-module, trim the library's imports. Keep one module but make sure
go-glximports nothing heavy (e.g. movedatagen.go). Graph pruning keeps compiled dependencies small, but the module-level noise for consumers remains. - C. Do nothing until there is a real external consumer of
go-glx.
Context
Raised in a review of go.mod alongside #1407. Related: whether go-git stays a dependency at all (#1409).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
goPull requests that update go codePull requests that update go codego-glxCore Go library (go-glx package)Core Go library (go-glx package)needs-triageIssue intake couldn't classify the Area — maintainer triage requiredIssue intake couldn't classify the Area — maintainer triage requiredtoolingInfrastructure, workflow, and developer toolsInfrastructure, workflow, and developer tools
Activity