New ๐ŸŒŠ wave for @helm

Commit 5af1ffbf

5af1ffbf4cb7Merged

Dmitriy Zhilyaev <[email protected]> ยท 2 years ago ยท 1 file ยท ~1 modified

Description

refactoring: RunPostBuild without defer

Signed-off-by: Dmitriy Zhilyaev [email protected]

Details

Commit
5af1ffbf4cb7
Parent
1fa89883a545

pkg/plan/build.gomodifiedView file

@@ -3,7 +3,6 @@
33 import (
44 "context"
55
6- "github.com/helmwave/helmwave/pkg/hooks"
76 log "github.com/sirupsen/logrus"
87 )
98
@@ -28,20 +27,24 @@
2827 }
2928 p.body = body
3029
31- // Run hooks
30+ // Run Pre hooks
3231 err = p.body.Lifecycle.RunPreBuild(ctx)
3332 if err != nil {
3433 return
3534 }
3635
37- defer func(Lifecycle *hooks.Lifecycle, ctx context.Context) {
38- err := Lifecycle.RunPostBuild(ctx)
39- if err != nil {
40- return
41- }
42- }(&p.body.Lifecycle, ctx)
36+ err = p.build(ctx, o)
37+ if err != nil {
38+ return
39+ }
40+
41+ // Run Post hooks
42+ err = p.body.Lifecycle.RunPostBuild(ctx)
43+ if err != nil {
44+ return
45+ }
4346
44- return p.build(ctx, o)
47+ return
4548 }
4649
4750 func (p *Plan) build(ctx context.Context, o BuildOptions) error {