rob05c commented on issue #4011: Implement GET /api/1.1/roles handler
URL: https://github.com/apache/trafficcontrol/pull/4011#issuecomment-545187363
 
 
   >Fixed. Those are interesting unit test failures. I assumed anonymously 
embedding a new RoleV11 struct into Role would be non-breaking, but I guess 
that actually breaks any previous usage of struct literals for Role. That's 
unfortunate :(.
   
   Yeah, it's an unfortunate quirk that Go doesn't allow direct access in 
embedded literals.
   
   I try to encourage
   ```
   foo := Foo{}
   foo.Bar = 42
   ```
   
   Instead of  `foo := Foo{Bar: 42}` For that reason.
   
   In fact, we could prevent the latter by making our versions have the latest 
always be empty. For example, if the latest version is 1.5, we currently
   ```
   type DeliveryService {
     DeliveryServiceV14
     New15Field int
   }
   ```
   
   I've wondered if instead we should:
   
   ```
   type DeliveryService struct {
     DeliveryServiceV15
   }
   
   type DeliveryServiceV15 {
     DeliveryServiceV14
     New15Field int
   }
   ```
   
   That would force people to either use the assignment syntax above, which 
keeps working with future versions, or else use the incredibly-awkward 
deeply-nested literals (which hopefully nobody would do).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to