Skip to content

Commit

Permalink
Small cleanup for the builder files (open-telemetry#64)
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
  • Loading branch information
bogdandrutu authored Sep 1, 2021
1 parent 6689c36 commit 08d2c20
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
8 changes: 4 additions & 4 deletions internal/builder/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,17 +121,17 @@ func (c *Config) ParseModules() error {
}

func parseModules(mods []Module) ([]Module, error) {
parsedModules := []Module{}
var parsedModules []Module
for _, mod := range mods {
if len(mod.GoMod) == 0 && !mod.Core {
if mod.GoMod == "" && !mod.Core {
return mods, fmt.Errorf("%w, module: %q", ErrInvalidGoMod, mod.GoMod)
}

if len(mod.Import) == 0 {
if mod.Import == "" {
mod.Import = strings.Split(mod.GoMod, " ")[0]
}

if len(mod.Name) == 0 {
if mod.Name == "" {
parts := strings.Split(mod.Import, "/")
mod.Name = parts[len(parts)-1]
}
Expand Down
5 changes: 1 addition & 4 deletions internal/builder/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,8 @@ import (
)

var (
// ErrFailedToGenerateSourceFromTemplate indicates a failure in writing the final contents to the destination file
ErrFailedToGenerateSourceFromTemplate = errors.New("failed to generate source from template")

// ErrGoNotFound is returned when a Go binary hasn't been found
ErrGoNotFound = errors.New("Go binary not found")
ErrGoNotFound = errors.New("go binary not found")
)

// GenerateAndCompile will generate the source files based on the given configuration, update go mod, and will compile into a binary
Expand Down

0 comments on commit 08d2c20

Please sign in to comment.