Migrated compute regions to use transport_tpg.SendRequest#16986
Migrated compute regions to use transport_tpg.SendRequest#16986jcromanu wants to merge 1 commit intoGoogleCloudPlatform:mainfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
Googlers: For automatic test runs see go/terraform-auto-test-runs. @rileykarson, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look. You can help make sure that review is quick by doing a self-review and by running impacted tests locally. |
|
Please remediate CLA issues |
557cbec to
e36898e
Compare
|
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
|
Tests analyticsTotal tests: 1405 Click here to see the affected service packages
Action takenFound 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
|
| } | ||
|
|
||
| regions := flattenRegions(resp.Items) | ||
| regions := flattenRegions(res["items"].([]interface{})) |
There was a problem hiding this comment.
The current implementation uses direct type assertions that will cause a panic if the API response does not match the expected structure or if the items list is missing.
Recommendation: Use the "comma-ok" assertion pattern:
var regions []string
if rawItems, ok := res["items"].([]interface{}); ok {
regions = flattenRegions(rawItems)
}
| result := make([]string, len(regions)) | ||
| for i, region := range regions { | ||
| result[i] = region.Name | ||
| regionMap := region.(map[string]interface{}) |
There was a problem hiding this comment.
Add safety checks to ensure region is a map and name is a string before asserting, see example:
var items []map[string]interface{}
if rawItems, ok := res["items"].([]interface{}); ok {
for _, rawItem := range rawItems {
// ...
}
}
e36898e to
61c1b96
Compare
|
@rileykarson This PR has been waiting for review for 3 weekdays. Please take a look! Use the label |
61c1b96 to
986c365
Compare
Release Note Template for Downstream PRs (will be copied)
See Write release notes for guidance.