Copilot commented on code in PR #160:
URL: https://github.com/apache/cloudstack-go/pull/160#discussion_r3714295484
##########
cloudstack/ManagementService.go:
##########
@@ -838,7 +838,7 @@ func (p *ReadyForShutdownParams) toURLValues() url.Values {
return u
}
if v, found := p.p["managementserverid"]; found {
- u.Set("managementserverid", v.(string))
+ u.Set("managementserverid", string(v.(UUID)))
Review Comment:
Consider using `v.(UUID).String()` (if `UUID` implements `fmt.Stringer`)
instead of `string(v.(UUID))`. It’s more idiomatic and safer if the underlying
`UUID` representation changes away from being a `string` alias. If `UUID` is
intentionally a `type UUID string`, current code is fine, but this couples
serialization format to the underlying type.
##########
generate/generate.go:
##########
@@ -1355,8 +1355,10 @@ func (s *service) generateConvertCode(cmd, name, typ
string) {
pn := s.pn
switch typ {
- case "string", "UUID":
+ case "string":
pn("u.Set(\"%s\", v.(string))", name)
+ case "UUID":
+ pn("u.Set(\"%s\", string(v.(UUID)))", name)
Review Comment:
The generator is now encoding knowledge of `UUID` as a special-case
string-like type. If there are (or will be) more string-backed custom types,
this can become a growing list of ad-hoc cases. Consider centralizing
\"string-like\" conversions (e.g., via a helper that maps Go types to
serialization expressions) so future additions don’t require touching switch
logic directly.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]