Skip to content

Commit 66879be

Browse files
committed
Warn unsupported multiple containers of the same type
1 parent f746f36 commit 66879be

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

internal/container/start.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ func Start(ctx context.Context, rt runtime.Runtime, sink output.Sink, platformCl
3939
return fmt.Errorf("failed to get config: %w", err)
4040
}
4141

42+
if hasDuplicateContainerTypes(cfg.Containers) {
43+
output.EmitWarning(sink, "running multiple emulators of the same type is not supported yet")
44+
}
45+
4246
containers := make([]runtime.ContainerConfig, len(cfg.Containers))
4347
for i, c := range cfg.Containers {
4448
image, err := c.Image()
@@ -247,3 +251,14 @@ func awaitStartup(ctx context.Context, rt runtime.Runtime, sink output.Sink, con
247251
}
248252
}
249253
}
254+
255+
func hasDuplicateContainerTypes(containers []config.ContainerConfig) bool {
256+
seen := make(map[config.EmulatorType]bool)
257+
for _, c := range containers {
258+
if seen[c.Type] {
259+
return true
260+
}
261+
seen[c.Type] = true
262+
}
263+
return false
264+
}

0 commit comments

Comments
 (0)