Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

validate container names #48

Merged
merged 1 commit into from
Jun 21, 2017
Merged

validate container names #48

merged 1 commit into from
Jun 21, 2017

Conversation

surajssd
Copy link
Member

@surajssd surajssd commented Jun 21, 2017

If multiple containers are specified we check if the name field for each container is given or not.

Fixes #32

@surajssd surajssd force-pushed the multiple-container-names branch from 0293e10 to bc8d6aa Compare June 21, 2017 09:17
@surajssd surajssd requested review from kadel and concaf June 21, 2017 09:17
// if not fail giving error
for cn, c := range app.PodSpec.Containers {
if c.Name == "" {
return nil, errors.New(fmt.Sprintf("app %q: container name not defined for app.containers[%d]", app.Name, cn))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its better to use fmt.Errorf("app %q: container name not defined for app.containers[%d]", app.Name, cn)
instead of combination errors.New(fmt.Sprintf(... It does the same thing, and its much more readable

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kadel we are using the pattern of wraping errors everywhere, isn't it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, but this is not about wraping errors, it'ts just that errors.New doest exactly the same thing, but you are calling only one function

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah sure done

If multiple containers are specified we check if the name
field for each container is given or not
@surajssd surajssd force-pushed the multiple-container-names branch from bc8d6aa to c6e7565 Compare June 21, 2017 12:33
@kadel kadel merged commit 31b7147 into master Jun 21, 2017
@surajssd surajssd deleted the multiple-container-names branch June 30, 2017 14:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants