Skip to content

Commit 08d2c20

Browse files
authored
Small cleanup for the builder files (#64)
Signed-off-by: Bogdan Drutu <[email protected]>
1 parent 6689c36 commit 08d2c20

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

internal/builder/config.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -121,17 +121,17 @@ func (c *Config) ParseModules() error {
121121
}
122122

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

130-
if len(mod.Import) == 0 {
130+
if mod.Import == "" {
131131
mod.Import = strings.Split(mod.GoMod, " ")[0]
132132
}
133133

134-
if len(mod.Name) == 0 {
134+
if mod.Name == "" {
135135
parts := strings.Split(mod.Import, "/")
136136
mod.Name = parts[len(parts)-1]
137137
}

internal/builder/main.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,8 @@ import (
2727
)
2828

2929
var (
30-
// ErrFailedToGenerateSourceFromTemplate indicates a failure in writing the final contents to the destination file
31-
ErrFailedToGenerateSourceFromTemplate = errors.New("failed to generate source from template")
32-
3330
// ErrGoNotFound is returned when a Go binary hasn't been found
34-
ErrGoNotFound = errors.New("Go binary not found")
31+
ErrGoNotFound = errors.New("go binary not found")
3532
)
3633

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

0 commit comments

Comments
 (0)