mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2025-02-22 21:40:42 +00:00
It is possible for filedesc to construct a lazy options decoder before the descriptor package has been imported. For example, top-level enum values are eagerly decoded, so a generated proto package can construct a lazy options decoder for an enum value at init time. Don't close over the variables in descopts. Instead, close over a pointer to the variable. Panic with an informative message in the case where options are decoded before the descriptor package has been initialized. Change-Id: I277a57602b083cb7bbf92c8114c50b467e59521f Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/188820 Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>