• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pantsbuild / pants / 33265103538
93%

Build:
DEFAULT BRANCH: main
Ran 29 Aug 2026 05:20PM UTC
Jobs 11
Files 1782
Run time 3min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

29 Aug 2026 05:14PM UTC coverage: 92.893% (-0.002%) from 92.895%
33265103538

push

github

web-flow
Infer dependencies across local `replace` directives in the Go backend (#23431)

## Problem

A `go.mod` can `replace` a required module with a path to a local
directory holding another first-party module:

```
// context/app/go.mod
require example.com/shared v0.0.0
replace example.com/shared => ../shared
```

Module analysis skips these, since they are not third-party packages,
and nothing folded the replaced module's packages into the referencing
module's import-path map. An import of `example.com/shared/pkg/field`
from `context/app` was therefore never resolved by dependency inference,
and every cross-module dependency had to be listed by hand in BUILD
metadata. In a repo whose first-party graph is wired together with
directory replaces, that is most of the dependency edges.

## Fix

`determine_go_mod_info` records each `replace` whose target is a local
directory, mapping the replaced module path to that directory relative
to the build root. It reads this from the `go mod` JSON metadata Pants
already fetches, so no extra process runs.

`map_import_paths_to_packages` merges the replaced module's own
packages, import paths at or under its module path, into the referencing
module's mapping. Its third-party dependencies are deliberately not
merged: the referencing module resolves those through its own `go.mod`,
and merging them would make shared third-party imports ambiguous and
silently suppress inference. Replace directives are not transitive in
Go, so the merge is one level deep. A module without a directory replace
takes the unchanged path.

Closes #22097, and the matching TODO in `third_party_pkg.py`.

## Verification

Two new tests in `target_type_rules_test.py` cover inference across a
locally-replaced sibling module, and a third-party import shared by both
modules staying unambiguous. The `util_rules/::` and `target_type_rules`
suites pass. Validated end to end on a real 24-module monorepo: every
cross-module import that previously needed an exp... (continued)

49 of 54 new or added lines in 3 files covered. (90.74%)

95539 of 102848 relevant lines covered (92.89%)

3.66 hits per line

Uncovered Changes

Lines Coverage ∆ File
3
94.4
-0.77% src/python/pants/backend/go/target_type_rules.py
2
85.83
-0.01% src/python/pants/backend/go/util_rules/go_mod.py
Jobs
ID Job ID Ran Files Coverage
1 test_python_linux_x86_64_4/10 - 33265103538.1 29 Aug 2026 05:30PM UTC 1245
58.75
GitHub Action Run
2 test_python_linux_x86_64_2/10 - 33265103538.2 29 Aug 2026 05:29PM UTC 1215
58.58
GitHub Action Run
3 test_python_linux_x86_64_7/10 - 33265103538.3 29 Aug 2026 05:30PM UTC 1219
50.46
GitHub Action Run
4 test_python_linux_x86_64_9/10 - 33265103538.4 29 Aug 2026 05:26PM UTC 1225
53.97
GitHub Action Run
5 test_python_linux_x86_64_1/10 - 33265103538.5 29 Aug 2026 05:27PM UTC 1215
48.87
GitHub Action Run
6 test_python_linux_x86_64_3/10 - 33265103538.6 29 Aug 2026 05:25PM UTC 1213
52.35
GitHub Action Run
7 test_python_linux_arm64 - 33265103538.7 29 Aug 2026 05:20PM UTC 1196
52.67
GitHub Action Run
8 test_python_linux_x86_64_8/10 - 33265103538.8 29 Aug 2026 05:28PM UTC 1214
52.73
GitHub Action Run
9 test_python_linux_x86_64_5/10 - 33265103538.9 29 Aug 2026 05:25PM UTC 1230
60.26
GitHub Action Run
10 test_python_linux_x86_64_6/10 - 33265103538.10 29 Aug 2026 05:25PM UTC 1212
50.04
GitHub Action Run
11 test_python_linux_x86_64_0/10 - 33265103538.11 29 Aug 2026 05:25PM UTC 1236
57.46
GitHub Action Run
Source Files on build 33265103538
  • Tree
  • List 1782
  • Changed 4
  • Source Changed 4
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #33265103538
  • 50857f58 on github
  • Prev Build on main (#33090306848)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc