Repository navigation
fix/issues-68-71: Apply go.mod replace directives, and keep provides_imports whole under -t - #85
Merged
Merged
Conversation
…mports whole under -t (#68, #71) - #68: go.sum records what the build uses, which is the replacement when a replace applies. The lock lookup used the required version, so a replaced dependency had no locked_version and no LOCKS edge. Facts now applies the replace by Go's rule (a replace of the required version wins over a version-less one): - replace x => y v1.2.0: the dependency keeps name x and spec, gets replaced_by "y@v1.2.0" and locked_version from y v1.2.0; - replace x => ../x: it is kept, with replaced_by "../x", "replace" in prov, and no locked_version (a local directory has no version). replaced_by is a new, omitted-when-empty field on the JSON dependency and a property on the DECLARES_DEPENDENCY edge. - #71: under -t the symbol table holds only the target packages, so provides_imports missed every other package's imports. A -t run now reads the import paths of every project package with a light package load (names, files and imports, no types; the full run's ./... and test setting), so it gets the same provides_imports as a full run. If that load fails, it warns and uses the symbol table's imports. Tests: module replace, local replace, two replaces, the Neo4j edge, and a -t run against a full run (a local library module, so no network). Each fails on the old code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rahlk
added a commit
that referenced
this pull request
Nov 30, 2026
fix/issues-68-71: Apply go.mod replace directives, and keep provides_imports whole under -t
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #68. Fixes #71.
Dependencies now follow
go.modreplacedirectives, and a-trun gives the sameprovides_importsas a full run.Motivation and Context
replacedirective makes the build use another module, another version or a local directory instead of the required one.go.sumrecords the replacement. The lock lookup used the required version, so a replaced dependency had nolocked_version, nolockfileprov and noLOCKSedge. The dependency now follows the replace, by Go's rule: a replace of the required version wins over a version-less one.replace x => y v1.2.0: the dependency keepsnamexand itsspec, so the code's imports ofxstill match it. It getsreplaced_byy@v1.2.0and takeslocked_versionfromy v1.2.0ingo.sum.replace x => ../x: the dependency is kept, withreplaced_by../xand"replace"inprov. It has nolocked_version, because a local directory has no version.-t, the symbol table has only the target packages, soprovides_importsmissed the imports of all other packages. A-trun now reads the import paths of every project package with a light package load (names and imports, no types; the build tags and the test setting of a full run). If that load fails, the run writes a warning and uses the imports of the target files.How Has This Been Tested?
replaced_byonDECLARES_DEPENDENCY;LOCKSfrom the replacement'sgo.sumline).provides_importsof a-trun with a full run. It uses a local library module, so it needs no network.go test ./...and golangci-lint pass.Breaking Changes
None.
dependencies[].replaced_byis a new field, left out when no replace applies. TheDECLARES_DEPENDENCYedge gets areplaced_byproperty only when a replace applies.Types of changes
Checklist
Additional context
replace, soreplaced_byis a Go field.-trun now costs one morego listof the project.docs/design/specs/v2-artifacts.md(the dependency fields, "replacedirectives", andprovides_imports).