Skip to content

Commit

Permalink
swap function order, update comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Kristina Pathak committed Apr 11, 2024
1 parent a25dc3b commit 4013dda
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions cmd/builder/internal/builder/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,8 @@ func GetModules(cfg Config) error {
for _, mod := range cfg.allComponents() {
module, version, _ := strings.Cut(mod.GoMod, " ")
if module == modulePath {
// Main module is not checked, by definition. This happens
// with --skip-new-go-module where the enclosing module
// contains the components used in the build.
// No need to check the version of components that are part of the
// module we're building from.

Check warning on line 173 in cmd/builder/internal/builder/main.go

View check run for this annotation

Codecov / codecov/patch

cmd/builder/internal/builder/main.go#L173

Added line #L173 was not covered by tests
continue
}

Expand All @@ -185,16 +184,6 @@ func GetModules(cfg Config) error {
return downloadModules(cfg)
}

func processAndWrite(cfg Config, tmpl *template.Template, outFile string, tmplParams any) error {
out, err := os.Create(filepath.Clean(filepath.Join(cfg.Distribution.OutputPath, outFile)))
if err != nil {
return err
}

defer out.Close()
return tmpl.Execute(out, tmplParams)
}

func downloadModules(cfg Config) error {
cfg.Logger.Info("Getting go modules")

Expand All @@ -213,6 +202,16 @@ func downloadModules(cfg Config) error {
return fmt.Errorf("%w: %s", errFailedToDownload, failReason)
}

func processAndWrite(cfg Config, tmpl *template.Template, outFile string, tmplParams any) error {
out, err := os.Create(filepath.Clean(filepath.Join(cfg.Distribution.OutputPath, outFile)))
if err != nil {
return err
}

defer out.Close()
return tmpl.Execute(out, tmplParams)
}

func (c *Config) coreModuleAndVersion() (string, string) {
module := "go.opentelemetry.io/collector"
if c.Distribution.RequireOtelColModule {

Check warning on line 217 in cmd/builder/internal/builder/main.go

View check run for this annotation

Codecov / codecov/patch

cmd/builder/internal/builder/main.go#L217

Added line #L217 was not covered by tests
Expand Down

0 comments on commit 4013dda

Please sign in to comment.