Skip to content

Use TypeSet instead of TypeList for projects, floatingips and licenses attributes #48

Merged
merged 5 commits into from
Nov 8, 2018

Conversation

ozerovandrei
Copy link
Contributor

Use TypeSet for the following attributes:

  • servers
  • quotas
  • all_quotas
  • resource_quotas

For #47

@ozerovandrei
Copy link
Contributor Author

@bill-rich this is ready for review.

Travis will fail on make website-test for now (because there is no selvpc provider in the Docker image).

Copy link

@bill-rich bill-rich left a comment

Choose a reason for hiding this comment

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

Just the one question I wanted to make sure I understand before approving. Looks good though!

func hashServers(v interface{}) int {
var buf bytes.Buffer
m := v.(map[string]interface{})
buf.WriteString(fmt.Sprintf("%s-", m["id"].(string)))

Choose a reason for hiding this comment

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

Why is bytes.Buffer used instead of just using fmt.Sprintf to generate a string?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, I just wanted to use same way in all hashSomething functions. But I agree, it's better to use fmt.Sprintf in cases where we don't check if attribute is set.
I will fix that in hashServers and hashQuotas functions.

@ozerovandrei
Copy link
Contributor Author

ozerovandrei commented Nov 7, 2018

@bill-rich I fixed the latest issue.

Use TypeSet to prevent unwanted diffs with changed order.
Use TypeSet to revent unwanted diffs with changed order.
Use TypeSet to revent unwanted diffs with changed order.
Use simple fmt.Sprintf instead of working with buffers in the
"hashQuotas" and "hashServers" functions.
Ensure "github.com/hashicorp/terraform/helper/hashcode" dependency.
Copy link

@bill-rich bill-rich left a comment

Choose a reason for hiding this comment

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

LGTM

@ozerovandrei ozerovandrei merged commit cd9b089 into master Nov 8, 2018
@ozerovandrei ozerovandrei deleted the fix/use-typeset branch November 8, 2018 07:56
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