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

未关闭
#1,549 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
12/100
Issue 类型
重构
描述清晰度
需要澄清
活跃度
活跃
技术栈
docker, go
领域
build-system

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
Go
星标
455
派生
2.5k
平均合并
22 小时 9 分钟
30 天内合并 PR
69

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

cloudfoundry/java-buildpack 的其他 Issue

查看 cloudfoundry/java-buildpack 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。