mirror of https://github.com/docker/cli.git
cli/compose/loader: Using a reference for the variable on range scope `overrideService` (scopelint)
``` cli/compose/loader/merge.go:64:41: Using a reference for the variable on range scope `overrideService` (scopelint) if err := mergo.Merge(&baseService, &overrideService, mergo.WithAppendSlice, mergo.WithOverride, mergo.WithTransformers(specials)); err != nil { ^ cli/compose/loader/loader_test.go:1587:28: Using the variable on range scope `testcase` in function literal (scopelint) config, err := loadYAML(testcase.yaml) ^ cli/compose/loader/loader_test.go:1590:58: Using the variable on range scope `testcase` in function literal (scopelint) assert.Check(t, is.DeepEqual(config.Services[0].Init, testcase.init)) ^ ``` Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
54d48de216
commit
96ec7299d8
|
@ -1583,6 +1583,7 @@ services:
|
|||
},
|
||||
}
|
||||
for _, testcase := range testcases {
|
||||
testcase := testcase
|
||||
t.Run(testcase.doc, func(t *testing.T) {
|
||||
config, err := loadYAML(testcase.yaml)
|
||||
assert.NilError(t, err)
|
||||
|
|
|
@ -60,6 +60,7 @@ func mergeServices(base, override []types.ServiceConfig) ([]types.ServiceConfig,
|
|||
},
|
||||
}
|
||||
for name, overrideService := range overrideServices {
|
||||
overrideService := overrideService
|
||||
if baseService, ok := baseServices[name]; ok {
|
||||
if err := mergo.Merge(&baseService, &overrideService, mergo.WithAppendSlice, mergo.WithOverride, mergo.WithTransformers(specials)); err != nil {
|
||||
return base, errors.Wrapf(err, "cannot merge service %s", name)
|
||||
|
|
Loading…
Reference in New Issue