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

docs(client): make example in README compile #604

Closed
wants to merge 1 commit into from

Conversation

samlaf
Copy link

@samlaf samlaf commented Dec 9, 2024

No description provided.

Copy link
Member

@abecevello abecevello left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution! I had a question and potential suggestion.

Also, in order to merge this change, the CLA must be signed using https://cla.shopify.com/ and then comment on this PR with "I have signed the CLA!" to re-run the checks.

Comment on lines +117 to +120
proxies, err = toxiClient.Proxies()
if err != nil {
panic(err)
}
Copy link
Member

Choose a reason for hiding this comment

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

This addition seems incorrect as proxies is assigned on line 108 as a result of the toxiClient.Populate call.

If this is meant as another example, similar to the example on line 122, I would be okay with this remaining but the indentation should be fixed, it should be commented out, and a comment added explaining what it does if its uncommented.

Copy link
Author

Choose a reason for hiding this comment

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

Populate returns an array, not a map: https://pkg.go.dev/github.com/shopify/toxiproxy/client#Client.Populate
Which is why this program was not compiling. I just looked through the API quickly and found Proxies() which returns a map instead. I'm assuming the API changed at some point. Not sure if this is correct semantically though... spent like 5 mins on this last night.

@samlaf
Copy link
Author

samlaf commented Dec 9, 2024

I have signed the CLA!

@abecevello
Copy link
Member

Thank you for the PR and bringing this to our attention. Actually fixing this example to compile with the current API required some more involved changes. I've made #607 which does all the updates. I'm going to close this PR in favour of that one.

@abecevello abecevello closed this Dec 11, 2024
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.

2 participants