Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[builder] remove ambigious import codepath #10015

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .chloggen/codeboten_remove-ambiguous-import-code.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
component: builder

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: remove the need to go get a module to address ambiguous import paths

# One or more tracking issues or pull requests related to the change
issues: [10015]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: []
6 changes: 0 additions & 6 deletions cmd/builder/internal/builder/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ var (
ErrGoNotFound = errors.New("go binary not found")
ErrDepNotFound = errors.New("dependency not found in go mod file")
ErrVersionMismatch = errors.New("mismatch in go.mod and builder configuration versions")
errGoGetFailed = errors.New("failed to go get")
errDownloadFailed = errors.New("failed to download go modules")
errCompileFailed = errors.New("failed to compile the OpenTelemetry Collector distribution")
skipStrictMsg = "Use --skip-strict-versioning to temporarily disable this check. This flag will be removed in a future minor version"
Expand Down Expand Up @@ -140,11 +139,6 @@ func GetModules(cfg Config) error {
return nil
}

// ambiguous import: found package cloud.google.com/go/compute/metadata in multiple modules
if _, err := runGoCommand(cfg, "get", "cloud.google.com/go"); err != nil {
return fmt.Errorf("%w: %s", errGoGetFailed, err.Error())
}

if _, err := runGoCommand(cfg, "mod", "tidy", "-compat=1.21"); err != nil {
return fmt.Errorf("failed to update go.mod: %w", err)
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/builder/internal/builder/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func TestVersioning(t *testing.T) {
cfg.Distribution.Go = "go"
cfg.Exporters = []Module{
{
GoMod: "go.opentelemetry.io/collector/exporter/otlpexporter v0.96.0",
GoMod: "go.opentelemetry.io/collector/exporter/otlpexporter v0.97.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to update these?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

previous versions relied on the ambiguous import

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So... previous versions now fail to build? Sorry, I don't get it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I wasn't really clear. Yes previous versions of the components (ones that import the problematic dependency) continue to raise an ambiguous import error unless they're updated.

},
}
cfg.Providers = &[]Module{}
Expand All @@ -154,7 +154,7 @@ func TestVersioning(t *testing.T) {
cfg.SkipStrictVersioning = true
cfg.Exporters = []Module{
{
GoMod: "go.opentelemetry.io/collector/exporter/otlpexporter v0.96.0",
GoMod: "go.opentelemetry.io/collector/exporter/otlpexporter v0.97.0",
},
}
cfg.Providers = &[]Module{}
Expand Down
1 change: 0 additions & 1 deletion cmd/builder/internal/config/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,3 @@ providers:
- gomod: go.opentelemetry.io/collector/confmap/provider/httpprovider v0.99.0
- gomod: go.opentelemetry.io/collector/confmap/provider/httpsprovider v0.99.0
- gomod: go.opentelemetry.io/collector/confmap/provider/yamlprovider v0.99.0

2 changes: 1 addition & 1 deletion cmd/otelcorecol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ require (
golang.org/x/net v0.24.0 // indirect
golang.org/x/text v0.14.0 // indirect
gonum.org/v1/gonum v0.15.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240314234333-6e1732d8331c // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda // indirect
google.golang.org/grpc v1.63.2 // indirect
google.golang.org/protobuf v1.33.0 // indirect
Expand Down
6 changes: 4 additions & 2 deletions cmd/otelcorecol/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading