Use pointers to resources in bundle configuration (#140)

Avoid copy-by-value when iterating over these maps.
This commit is contained in:
Pieter Noordhuis 2022-12-15 13:00:41 +01:00 committed by GitHub
parent 4e834857e6
commit 72e89bf33c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 7 deletions

View File

@ -1,9 +1,11 @@
package config package config
import "github.com/databricks/bricks/bundle/config/resources" import (
"github.com/databricks/bricks/bundle/config/resources"
)
// Resources defines Databricks resources associated with the bundle. // Resources defines Databricks resources associated with the bundle.
type Resources struct { type Resources struct {
Jobs map[string]resources.Job `json:"jobs,omitempty"` Jobs map[string]*resources.Job `json:"jobs,omitempty"`
Pipelines map[string]resources.Pipeline `json:"pipelines,omitempty"` Pipelines map[string]*resources.Pipeline `json:"pipelines,omitempty"`
} }

View File

@ -33,8 +33,8 @@ func TestConvertJob(t *testing.T) {
var config = config.Root{ var config = config.Root{
Resources: config.Resources{ Resources: config.Resources{
Jobs: map[string]resources.Job{ Jobs: map[string]*resources.Job{
"my_job": src, "my_job": &src,
}, },
}, },
} }
@ -67,8 +67,8 @@ func TestConvertJobTaskLibraries(t *testing.T) {
var config = config.Root{ var config = config.Root{
Resources: config.Resources{ Resources: config.Resources{
Jobs: map[string]resources.Job{ Jobs: map[string]*resources.Job{
"my_job": src, "my_job": &src,
}, },
}, },
} }