Skip to content

Commit

Permalink
[builder] remove ambigious import codepath (#10015)
Browse files Browse the repository at this point in the history
This code was added to handled an ambiguous import caused by a
dependency that has been updated since v0.98.0.

---------

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
  • Loading branch information
codeboten authored Apr 24, 2024
1 parent ae83654 commit 326ef7c
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 12 deletions.
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",
},
}
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.

0 comments on commit 326ef7c

Please sign in to comment.