cmd/protoc-gen-go, runtime/protoimpl: enforce minimum and maximum versions
Generate the needed infrastructure to ensure that we can statically
enforce minimum and maximum versions. This enables us to have a policy
when we release v2 where it fails to build for:
* new generated code with really old runtimes
* new runtimes with really old generated code
Change-Id: Ib699ad62c06dff8f9285806394a741c18db00288
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/178546
Reviewed-by: Damien Neil <dneil@google.com>
diff --git a/internal/testprotos/test/ext.pb.go b/internal/testprotos/test/ext.pb.go
index 9f6915d..58cb656 100644
--- a/internal/testprotos/test/ext.pb.go
+++ b/internal/testprotos/test/ext.pb.go
@@ -11,7 +11,12 @@
sync "sync"
)
-const _ = protoimpl.EnforceVersion(protoimpl.Version - 0)
+const (
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 0)
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(0 - protoimpl.MinVersion)
+)
var file_test_ext_proto_extDescs = []protoiface.ExtensionDescV1{
{