88 "github.com/databricks/cli/bundle"
99 "github.com/databricks/cli/libs/diag"
1010 "github.com/databricks/cli/libs/dyn"
11- "github.com/databricks/cli/libs/log"
1211)
1312
1413func createGlobError (v dyn.Value , p dyn.Path , message string ) diag.Diagnostic {
@@ -30,25 +29,20 @@ func createGlobError(v dyn.Value, p dyn.Path, message string) diag.Diagnostic {
3029 }
3130}
3231
33- func expandGlobs (ctx context.Context , b * bundle.Bundle , name string ) diag.Diagnostics {
34- err := b .Config .MarkMutatorEntry (ctx )
35- if err != nil {
36- log .Errorf (ctx , "entry error: %s" , err )
37- return diag .Errorf ("entry error: %s" , err )
38- }
32+ type expandGlobs struct {
33+ name string
34+ }
3935
40- defer func () {
41- err := b .Config .MarkMutatorExit (ctx )
42- if err != nil {
43- log .Errorf (ctx , "exit error: %s" , err )
44- }
45- }()
36+ func (e expandGlobs ) Name () string {
37+ return "expandGlobs"
38+ }
4639
40+ func (e expandGlobs ) Apply (ctx context.Context , b * bundle.Bundle ) diag.Diagnostics {
4741 // Base path for this mutator.
4842 // This path is set with the list of expanded globs when done.
4943 base := dyn .NewPath (
5044 dyn .Key ("artifacts" ),
51- dyn .Key (name ),
45+ dyn .Key (e . name ),
5246 dyn .Key ("files" ),
5347 )
5448
@@ -59,7 +53,7 @@ func expandGlobs(ctx context.Context, b *bundle.Bundle, name string) diag.Diagno
5953 )
6054
6155 var diags diag.Diagnostics
62- err = b .Config .Mutate (func (v dyn.Value ) (dyn.Value , error ) {
56+ err : = b .Config .Mutate (func (v dyn.Value ) (dyn.Value , error ) {
6357 var output []dyn.Value
6458 _ , err := dyn .MapByPattern (v , pattern , func (p dyn.Path , v dyn.Value ) (dyn.Value , error ) {
6559 if v .Kind () != dyn .KindString {
0 commit comments