Skip to content

Commit

Permalink
Don't escape go error output in builder (#6603)
Browse files Browse the repository at this point in the history
Fixes #6591
  • Loading branch information
mattsains authored Nov 28, 2022
1 parent a8645ad commit 30cac33
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmd/builder/internal/builder/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func Compile(cfg Config) error {
cmd := exec.Command(cfg.Distribution.Go, args...)
cmd.Dir = cfg.Distribution.OutputPath
if out, err := cmd.CombinedOutput(); err != nil {
return fmt.Errorf("failed to compile the OpenTelemetry Collector distribution: %w. Output: %q", err, out)
return fmt.Errorf("failed to compile the OpenTelemetry Collector distribution: %w. Output:\n%s", err, out)
}
cfg.Logger.Info("Compiled", zap.String("binary", fmt.Sprintf("%s/%s", cfg.Distribution.OutputPath, cfg.Distribution.Name)))

Expand All @@ -112,7 +112,7 @@ func GetModules(cfg Config) error {
cmd := exec.Command(cfg.Distribution.Go, "mod", "tidy", "-compat=1.18")
cmd.Dir = cfg.Distribution.OutputPath
if out, err := cmd.CombinedOutput(); err != nil {
return fmt.Errorf("failed to update go.mod: %w. Output: %q", err, out)
return fmt.Errorf("failed to update go.mod: %w. Output:\n%s", err, out)
}

cfg.Logger.Info("Getting go modules")
Expand All @@ -125,7 +125,7 @@ func GetModules(cfg Config) error {
cmd := exec.Command(cfg.Distribution.Go, "mod", "download")
cmd.Dir = cfg.Distribution.OutputPath
if out, err := cmd.CombinedOutput(); err != nil {
failReason = fmt.Sprintf("%s. Output: %q", err, out)
failReason = fmt.Sprintf("%s. Output:\n%s", err, out)
cfg.Logger.Info("Failed modules download", zap.String("retry", fmt.Sprintf("%d/%d", i, retries)))
time.Sleep(5 * time.Second)
continue
Expand Down

0 comments on commit 30cac33

Please sign in to comment.