diff --git a/container/container.go b/container/container.go index 02cd534..af91c87 100644 --- a/container/container.go +++ b/container/container.go @@ -84,6 +84,9 @@ func New(t terminalapi.Terminal, opts ...Option) (*Container, error) { if err := applyOptions(root, opts...); err != nil { return nil, err } + if err := validateOptions(root); err != nil { + return nil, err + } return root, nil } diff --git a/container/options.go b/container/options.go index 9e76583..40b7831 100644 --- a/container/options.go +++ b/container/options.go @@ -35,7 +35,11 @@ func applyOptions(c *Container, opts ...Option) error { return err } } + return nil +} +// validateOptions validates options set in the container tree. +func validateOptions(c *Container) error { // ensure all the container identifiers are either empty or unique. var errStr string seenID := map[string]bool{}