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

pantsbuild / pants / 29631338772
93%

Build:
DEFAULT BRANCH: main
Ran 18 Jul 2026 05:02AM UTC
Jobs 11
Files 1774
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

18 Jul 2026 04:54AM UTC coverage: 93.083% (+0.1%) from 92.983%
29631338772

push

github

web-flow
feat(golang): add module level granularity for third party dependencies (#23499)

This PR adds a new opt-in model for go third party module dependencies,
which is one target per module instead of one target per package.

### Background

The problem today is that some dependencies, for example cloud provider
libraries, contain a lot of packages. Currently the go backend maps each
third party package to a generated target, and infers the entire
dependency graph between all packages across all third party modules. In
a repo with 800+ third party dependencies, this leads to **over 12000
third party package targets** that all go through a dependency inference
walk. This leads to a lot of engine overhead. This is especially painful
for CI when running `--changed-since` with `--changed-dependents`, since
every single CI run is hit by this at startup regardless if golang is
affected by the change.

In my case with a multi-language repo where Go is under-represented,
this inference is the majority cost of pants startup on all runs.

This improvement goes beyond just dependency inference, as shown in
benchmarks, but it was the main driver for the change.

### This PR

Adds a new option `[golang].third_party_target_granularity` with the
options `package` or `module`. `package` retains the current behavior of
generating targets per third party package. `module` only creates one
target per third party module.

I've added the two modes as moving to `module` has some theoretical
breaking cases since third party packages are not addressable with this
mode. So any explicit dependency references or a main-reference into a
third party package would no longer work.

I have instead added another field `main_import_path` to `go_binary`
which covers targeting a third party package as the main package even
when using `module` granularity. This field is also supported for
`package` mode.

### Implementation notes

Module targets are represented by the existing `go_third_party... (continued)

492 of 536 new or added lines in 19 files covered. (91.79%)

138 existing lines in 12 files now uncovered.

95217 of 102293 relevant lines covered (93.08%)

3.68 hits per line

Uncovered Changes

Lines Coverage ∆ File
18
79.55
src/python/pants/backend/go/util_rules/build_pkg_stdlib.py
8
78.23
78.23% src/python/pants/backend/go/goals/debug_goals.py
7
89.23
src/python/pants/backend/go/util_rules/build_pkg_third_party.py
4
95.17
-0.61% src/python/pants/backend/go/target_type_rules.py
3
94.12
-3.96% src/python/pants/backend/go/goals/package_binary.py
2
94.54
4.47% src/python/pants/backend/go/util_rules/build_pkg_target.py
1
92.75
0.24% src/python/pants/backend/codegen/protobuf/go/rules.py
1
97.76
-0.56% src/python/pants/backend/go/target_types.py

Coverage Regressions

Lines Coverage ∆ File
26
90.49
0.14% src/python/pants/backend/go/util_rules/third_party_pkg.py
23
78.23
78.23% src/python/pants/backend/go/goals/debug_goals.py
18
92.47
0.03% src/python/pants/backend/go/goals/test.py
15
92.75
0.24% src/python/pants/backend/codegen/protobuf/go/rules.py
15
85.84
0.39% src/python/pants/backend/go/util_rules/go_mod.py
12
94.54
4.47% src/python/pants/backend/go/util_rules/build_pkg_target.py
10
95.17
-0.61% src/python/pants/backend/go/target_type_rules.py
6
0.0
0.0% src/python/pants/backend/experimental/go/register.py
5
94.67
0.03% src/python/pants/backend/go/util_rules/build_pkg_target_test.py
4
94.12
-3.96% src/python/pants/backend/go/goals/package_binary.py
2
98.06
0.0% src/python/pants/backend/go/goals/tailor.py
2
97.76
-0.56% src/python/pants/backend/go/target_types.py
Jobs
ID Job ID Ran Files Coverage
1 test_python_linux_x86_64_6/10 - 29631338772.1 18 Jul 2026 05:03AM UTC 1208
49.66
GitHub Action Run
2 test_python_linux_x86_64_8/10 - 29631338772.2 18 Jul 2026 05:05AM UTC 1212
52.72
GitHub Action Run
3 test_python_linux_x86_64_1/10 - 29631338772.3 18 Jul 2026 05:05AM UTC 1213
48.97
GitHub Action Run
4 test_python_linux_x86_64_7/10 - 29631338772.4 18 Jul 2026 05:05AM UTC 1214
50.63
GitHub Action Run
5 test_python_linux_x86_64_4/10 - 29631338772.5 18 Jul 2026 05:07AM UTC 1243
58.91
GitHub Action Run
6 test_python_linux_x86_64_9/10 - 29631338772.6 18 Jul 2026 05:06AM UTC 1223
54.04
GitHub Action Run
7 test_python_linux_arm64 - 29631338772.7 18 Jul 2026 05:02AM UTC 1192
51.63
GitHub Action Run
8 test_python_linux_x86_64_5/10 - 29631338772.8 18 Jul 2026 05:04AM UTC 1227
60.27
GitHub Action Run
9 test_python_linux_x86_64_2/10 - 29631338772.9 18 Jul 2026 05:04AM UTC 1213
58.75
GitHub Action Run
10 test_python_linux_x86_64_3/10 - 29631338772.10 18 Jul 2026 05:04AM UTC 1211
52.32
GitHub Action Run
11 test_python_linux_x86_64_0/10 - 29631338772.11 18 Jul 2026 05:03AM UTC 1233
57.22
GitHub Action Run
Source Files on build 29631338772
  • Tree
  • List 1774
  • Changed 27
  • Source Changed 18
  • Coverage Changed 26
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #29631338772
  • 295dc493 on github
  • Prev Build on main (#29628206316)
  • Next Build on main (#29652880944)
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