|
|
|
|
|
by joahnn_s
274 days ago
|
|
Who's actually expecting `xyz.com` here? Spec: https://go.dev/ref/spec#Selectors
> x.f resolves to the field/method at the shallowest depth in T. If there isn’t exactly one at that depth, it’s illegal. Embedding promotes fields; on name collisions the shallowest wins. So `opts.URL` is `FooService.URL` (depth 1), not `BarConnectionOptions.URL` (depth 2). |
|
Even given that it compiles, I wouldn’t exclude it being a runtime error.
But the big problem isn’t that it behaves as advertised, it’s that it is way too easy to write opts.URL where you mean opts.Bar.URL. Auto-complete will happily compete the wrong thing for you.