Copilot commented on code in PR #153: URL: https://github.com/apache/cloudstack-terraform-provider/pull/153#discussion_r2315270288
########## cloudstack/resource_cloudstack_instance.go: ########## @@ -307,6 +315,14 @@ func resourceCloudStackInstanceCreate(d *schema.ResourceData, meta interface{}) p.SetNetworkids([]string{d.Get("network_id").(string)}) } + if networks, ok := d.GetOk("network_ids"); ok { + var networkIds []string + for _, nw := range networks.([]interface{}) { + networkIds = append(networkIds, fmt.Sprintf("%v", nw)) Review Comment: Using fmt.Sprintf with %v is unnecessary and potentially unsafe for type conversion. Since the schema defines the element type as TypeString, cast directly to string: `networkIds = append(networkIds, nw.(string))` ```suggestion networkIds = append(networkIds, nw.(string)) ``` ########## cloudstack/resource_cloudstack_instance.go: ########## @@ -307,6 +315,14 @@ func resourceCloudStackInstanceCreate(d *schema.ResourceData, meta interface{}) p.SetNetworkids([]string{d.Get("network_id").(string)}) } + if networks, ok := d.GetOk("network_ids"); ok { + var networkIds []string + for _, nw := range networks.([]interface{}) { + networkIds = append(networkIds, fmt.Sprintf("%v", nw)) + } + p.SetNetworkids(networkIds); Review Comment: Remove the semicolon at the end of the line. Go does not require semicolons at the end of statements. ```suggestion p.SetNetworkids(networkIds) ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@cloudstack.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org