Skip to content

Commit

Permalink
chore: minor code improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
bartoszmajsak committed Dec 19, 2023
1 parent 0f0d110 commit 0f1b79a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
14 changes: 6 additions & 8 deletions pkg/feature/feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ type Feature struct {
DynamicClient dynamic.Interface
Client client.Client

manifests []manifest
fsys fs.FS
manifests []manifest

cleanups []Action
resources []Action
preconditions []Action
postconditions []Action
loaders []Action
fsys fs.FS
}

// Action is a func type which can be used for different purposes while having access to Feature struct.
Expand Down Expand Up @@ -69,7 +70,7 @@ func (f *Feature) Apply() error {
return multiErr.ErrorOrNil()
}

// create or update resources
// Create or update resources
for _, resource := range f.resources {
if err := resource(f); err != nil {
return err
Expand All @@ -89,15 +90,12 @@ func (f *Feature) Apply() error {
return err
}

// Check all postconditions and collect errors
for _, postcondition := range f.postconditions {
multiErr = multierror.Append(multiErr, postcondition(f))
}

if multiErr.ErrorOrNil() != nil {
return multiErr.ErrorOrNil()
}

return nil
return multiErr.ErrorOrNil()
}

func (f *Feature) Cleanup() error {
Expand Down
6 changes: 3 additions & 3 deletions pkg/feature/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ const (

type manifest struct {
name,
path string
template bool
patch bool
path,
processedContent string
template,
patch bool
}

func loadManifestsFrom(fsys fs.FS, path string) ([]manifest, error) {
Expand Down

0 comments on commit 0f1b79a

Please sign in to comment.