Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove obsolete comments in types.go #4541

Merged
merged 1 commit into from
Feb 19, 2015
Merged

Conversation

yujuhong
Copy link
Contributor

This fixes #4519.

@@ -61,7 +61,7 @@ type ContainerManifest struct {
Volumes []Volume `json:"volumes" description:"list of volumes that can be mounted by containers belonging to the pod"`
Containers []Container `json:"containers" description:"list of containers belonging to the pod"`
RestartPolicy RestartPolicy `json:"restartPolicy,omitempty" description:"restart policy for all containers within the pod; one of RestartPolicyAlways, RestartPolicyOnFailure, RestartPolicyNever"`
// Optional: Set DNS policy. Defaults to "ClusterFirst"
// Required: Set DNS policy.
Copy link
Member

Choose a reason for hiding this comment

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

By definition, defaulted fields are not required in the versioned types.go files.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I misunderstood the meaning of the comment. The defaults are applied when converting a versioned object to the internal one, so they are defaulted. I will upload a new patch.

@bgrant0607
Copy link
Member

LGTM

bgrant0607 added a commit that referenced this pull request Feb 19, 2015
Remove obsolete comments in types.go
@bgrant0607 bgrant0607 merged commit 1ba1c1c into kubernetes:master Feb 19, 2015
@thockin
Copy link
Member

thockin commented Feb 19, 2015

If every field is required is it worth spelling out? :)

@bgrant0607
Copy link
Member

Maybe not, though it is a change, so perhaps useful for a while.

@yujuhong
Copy link
Contributor Author

@thockin, I couldn't find a consistent pattern of when to comment in the file. There are "required" and "optional" in multiple places, irregardless of this PR. Agreed that we probably should clean up all of them at once :)

By the way, there are still some optional fields with default values. For example, some bool fields are defaulted to false. I believe this depends on the implicit struct initialization behavior in golang. Is that true/intentional?

@thockin
Copy link
Member

thockin commented Feb 19, 2015

Yeah, there's not much we can do about zero-values short of running all
construction through functions with explicit arguments.

On Wed, Feb 18, 2015 at 11:56 PM, Yu-Ju Hong notifications@github.com
wrote:

@thockin https://github.com/thockin, I couldn't find a consistent
pattern of when to comment in the file. There are "required" and "optional"
in multiple places, irregardless of this PR. Agreed that we probably should
clean up all of them at once :)

By the way, there are still some optional fields with default values. For
example, some bool fields are defaulted to false. I believe this depends on
the implicit struct initialization behavior in golang. Is that
true/intentional?

Reply to this email directly or view it on GitHub
#4541 (comment)
.

@yujuhong yujuhong deleted the lies branch March 5, 2015 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No defaulting in pkg/api/types.go means comments are lying
3 participants