Skip to content

[cmd/builder] --skip-get-modules shouldn't regenerate go.mod #15390

Description

@braydonk

Component(s)

cmd/builder

What happened?

Describe the bug
When you call ocb with --skip-get-modules, it correctly skips the go mod tidy step. However, it still regenerates the go.mod file. This means that the subsequent build that occurs after that will inherently need to make the same jump of go mod tidy that you want to avoid with that flag in the first place.

Steps to reproduce
Use --skip-get-modules feature.

What did you expect to see?
My go.mod to maintain the updates I had made to it, such as go geting a specific dependency I want to keep patched up in my build.

What did you see instead?
The go.mod was regenerated from the template, essentially creating an untidied go.mod file with the base dependencies that ocb can figure out, which will then be resolved the same way a go mod tidy would when you run the build on it.

Collector version

v0.153.0

Environment information

Environment

OS: Any
Compiler(if manually compiled): go1.26.2

OpenTelemetry Collector configuration

N/A

Log output

N/A

Additional context

This is related to my work about making ocb useful when you need the generated source code to live for a long time. The big thing I want to enable is to be able to run ocb to update templates without blowing away the go.mod updates that have already occurred. This is particularly useful if you're patching a dependency and want to update the version of your binary, but don't want to blow away the patches your go.mod may already have.

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions