mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2025-01-06 00:55:51 +00:00
f98dd98c15
Suppose some init logic performs protobuf reflection. If so, it will cause the lazy descriptor init logic to be executed. This is problematic for weak fields since we can not be certain that all weak references have been registered at this point in time. This is a fundamental issue with with weak dependencies, since it means that we cannot enforce any ordering constraints on the weak dependency unless we directly import the weakly referenced package (which would defeat the point of weak imports). Alleviate the problem by pushing evaluation of weak reference to actual usage. This does not completely fix the problem, but signifcantly reduces the probability of it being problematic. In general, people should avoid interacting with weak fields at init time. Change-Id: Ie5957ddedd61333e72ee9a1bba0c53dace65547c Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/188982 Reviewed-by: Damien Neil <dneil@google.com> |
||
---|---|---|
.. | ||
build_test.go | ||
build.go | ||
desc_init.go | ||
desc_lazy.go | ||
desc_list_gen.go | ||
desc_list.go | ||
desc_test.go | ||
desc.go | ||
placeholder.go |