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

Updating api_installer to register paths in a deterministic order to get a deterministic swagger spec #5426

Merged
merged 1 commit into from
Mar 13, 2015

Conversation

nikhiljindal
Copy link
Contributor

Fixing our code for #5425

@googlebot
Copy link

Thanks for your pull request.

It looks like this may be your first contribution to a Google open source project, in which case you'll need to sign a Contributor License Agreement (CLA) at https://cla.developers.google.com/.

If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check the information on your CLA or see this help article on setting the email on your git commits.

Once you've done that, please reply here to let us know. If you signed the CLA as a corporation, please let us know the company's name.

// Register the paths in a deterministic (sorted) order to get a deterministic swagger spec.
paths := make([]string, len(a.group.Storage))
var i int = 0
for path := range a.group.Storage {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not:

for i, path := range a.group.Storage {

? Since this is really a projection function?
You don't need to change it -- I thought I would just ask.
Another pattern is paths := []string{} and then paths = append(paths, path) but what you have written is perhaps a little better for allocation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IIUC, That will not work because a.group.Storage is a map. There is no concept of an index in a map.

for i, path := range a.group.Storage {

will give me the key in i and value in path.

Regarding using

paths := []string{}
paths = append(paths, path)

Yes. What I have, I believe, is better for allocation.

@satnam6502 satnam6502 self-assigned this Mar 13, 2015
@satnam6502
Copy link
Contributor

Also, why do you get the cla:no tag?

@bgrant0607
Copy link
Member

Re. CLA: because @nikhiljindal didn't join the https://github.com/google org.

@nikhiljindal
Copy link
Contributor Author

I did join that org. I see the Google badge on my profile and I see my name there in "people" section of the group.
My membership was private. Have changed that to public now.

@satnam6502 satnam6502 added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 13, 2015
satnam6502 added a commit that referenced this pull request Mar 13, 2015
Updating api_installer to register paths in a deterministic order to get a deterministic swagger spec
@satnam6502 satnam6502 merged commit df0838e into kubernetes:master Mar 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants