rob05c commented on code in PR #6756:
URL: https://github.com/apache/trafficcontrol/pull/6756#discussion_r850777407
##########
cache-config/t3cutil/toreq/client.go:
##########
@@ -48,8 +48,22 @@ import (
)
type TOClient struct {
- c *toclient.Session
- old *toreqold.TOClient
+ // c is the "new" Traffic Ops client, for the latest major API.
+ //
+ // This MUST NOT be accessed without checking for nil.
+ // If the Traffic Ops server doesn't support the latest API, it will
fall back,
+ // and c will be nil and old will not, and old must be used.
+ //
+ // **WARNING** This MUST NOT be accessed without checking for nil. See
above.
+ c *toclient.Session
Review Comment:
This is something of a footgun. This being the second panic we've had
recently. It'd be really nice to make it impossible to happen, but that'd
require quite a bit of abstraction, it'd be a lot of code. So for now, I added
some giant warning comments on the symbol. If it happens again, we can
reconsider if the abstraction to make it impossible is worth it.
--
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]