Test-only Go dependencies force the Go version of the whole repo (see #1548)

Aperta
#1,549 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
12/100
Tipo di issue
Refactoring
Chiarezza
Da chiarire
Stato di attività
Attiva
Stack tecnologico
docker, go
Ambito
build-system

Direzione di ricerca

Start with the open question in the issue: whether vendor/ is needed because bin/supply and bin/finalize build offline, which you can check in scripts/install_go.sh and the packaging scripts. Then look at go.mod, src/integration, and scripts/integration.sh to see which modules come only from the integration tests. This needs a maintainer decision on the approach before any code change, so done means that decision is recorded.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

While looking at Dependabot PR #1548 I noticed that a test-only dependency can raise the Go version for the whole repo.

go.mod says go 1.25.4, and scripts/install_go.sh installs Go 1.25.10, which bin/supply and bin/finalize use for go build -mod=vendor. otel 1.47.0 needs Go 1.26, so #1548 changes go.mod to go 1.26.0. The build with Go 1.25.10 (GOTOOLCHAIN=local) then fails with go: go.mod requires go >= 1.26.0. On main it works.

The buildpack binaries (supply, finalize, javaexec) only use a few modules: libbuildpack, libbuildpack-dynatrace, the two semver libraries, backoff, the YAML libraries and golang.org/x. OpenTelemetry is pulled in by the integration tests: go mod why go.opentelemetry.io/otel gives src/integration -> switchblade -> docker/docker/client -> otelhttp -> otel. As far as I can see, the same tooling brings in many of the other test-only modules. vendor/ holds 51 modules in 1,526 committed files (24 MB), so one bump can change tens of thousands of lines (#1528: about 35,000, of which 90% are two generated files).

Some ideas, in the order I would try them:

  1. Move src/integration into its own Go module (own go.mod and vendor/). Bumps of switchblade, the Docker client or otel would then no longer change the Go version or the vendored code of the buildpack itself. I have not tried this; scripts/integration.sh and the CI jobs would need a check.
  2. Dependabot rules: group or ignore the test-only modules, so a Go version jump is not proposed as a routine update.
  3. Raise the Go version of the buildpack on purpose now and then, in its own PR (new version and sha256 per stack in install_go.sh), so the gap to the newest Go stays small.

Question: is vendor/ needed because bin/supply and bin/finalize build from source when staging (possibly without network access), or is there another reason? That would help to decide which of these ideas makes sense.

Lingua principale
Go
Stelle
455
Fork
2.5k
Merge medio
22h 9m
PR unite (30g)
69

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di cloudfoundry/java-buildpack

Tutte le issue di cloudfoundry/java-buildpack

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.