浏览代码

prevent assignment to entry in nil map

Signed-off-by: Nicolas De Loof <[email protected]>
Nicolas De Loof 2 年之前
父节点
当前提交
93bffd9a7f
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      pkg/compose/build.go

+ 2 - 2
pkg/compose/build.go

@@ -303,10 +303,10 @@ func (s *composeService) toBuildOptions(project *types.Project, service types.Se
 }
 
 func flatten(in types.MappingWithEquals) types.Mapping {
+	out := types.Mapping{}
 	if len(in) == 0 {
-		return nil
+		return out
 	}
-	out := types.Mapping{}
 	for k, v := range in {
 		if v == nil {
 			continue