runtime/protoimpl, cmd/protoc-gen-go: support release versioning

In order for protoc-gen-go to output the current version,
it needs to know what version it is currently running as.
However, we cannot rely on the git tags since the tags are not
made until *after* the commit has been submitted.
Instead, we manually encode the version into the code and
make sure that git tags match up with the version in the code.

The version.go file in runtime/protoimpl contains instructions
for how to make a release. Essentially:
* Every non-release commit has a version string with "devel" in it.
* Every release commit must not have "devel" in it and must be unique.
* The "release process" involves submitting two CLs.
The first CL creates a version string without "devel",
which is the commit that a git tag will actually reference.
The second CL follows immediately and re-introduces "devel"
into the version string.

The following example shows a possible sequence of VersionStrings
for git commits in time-ascending order:
	v1.19.0-devel      (this CL)
	v1.19.0-devel
	v1.19.0-devel
	v1.19.0-devel
	v1.20.0-rc.1       <- tagged
	v1.20.0-rc.1.devel
	v1.20.0-rc.1.devel
	v1.20.0-rc.1.devel
	v1.20.0-rc.2       <- tagged
	v1.20.0-rc.2.devel
	v1.20.0            <- tagged (future public release)
	v1.20.0-devel
	v1.20.0-devel
	v1.20.0-devel
	v1.20.0-devel
	v1.20.1            <- tagged
	v1.20.1-devel
	v1.20.1-devel
	v1.21.0            <- tagged
	v1.21.0-devel

Note that we start today with v1.19.0-devel, which means that our initial
release will be v1.20.0. This number was intentionally chosen since
1) the number 20 has some correlation to the fact that we keep calling
the new implementation the "v2" implementation, and
2) the set of tagged versions for github.com/golang/protobuf
and google.golang.org/protobuf are unlikely to ever overlap.
This way, the version of protoc-gen-go is never ambiguous which module
it was built from.

Now that we have version information, we add support for generating .pb.go
files with the version information recorded. However, we do not emit
these for .pb.go files in our own repository since they are always guaranteed
to be at the right version (enforced by integration_test.go).

Updates golang/protobuf#524

Change-Id: I25495a45042c2aa39a39cb7e7738ae8e831a9d26
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/186117
Reviewed-by: Damien Neil <dneil@google.com>
diff --git a/internal/cmd/generate-protos/main.go b/internal/cmd/generate-protos/main.go
index ddfac15..734aa26 100644
--- a/internal/cmd/generate-protos/main.go
+++ b/internal/cmd/generate-protos/main.go
@@ -53,6 +53,7 @@
 					if file.Generate {
 						switch plugin {
 						case "go":
+							gengo.GenerateVersionMarkers = false
 							gengo.GenerateFile(gen, file)
 							generateFieldNumbers(gen, file)
 						case "gogrpc":
diff --git a/internal/testprotos/benchmarks/benchmarks.pb.go b/internal/testprotos/benchmarks/benchmarks.pb.go
index 97dff4d..c07f40a 100644
--- a/internal/testprotos/benchmarks/benchmarks.pb.go
+++ b/internal/testprotos/benchmarks/benchmarks.pb.go
@@ -40,13 +40,6 @@
 	sync "sync"
 )
 
-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)
-)
-
 type BenchmarkDataset struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
diff --git a/internal/testprotos/benchmarks/datasets/google_message1/proto2/benchmark_message1_proto2.pb.go b/internal/testprotos/benchmarks/datasets/google_message1/proto2/benchmark_message1_proto2.pb.go
index 13c237a..f641592 100644
--- a/internal/testprotos/benchmarks/datasets/google_message1/proto2/benchmark_message1_proto2.pb.go
+++ b/internal/testprotos/benchmarks/datasets/google_message1/proto2/benchmark_message1_proto2.pb.go
@@ -12,13 +12,6 @@
 	sync "sync"
 )
 
-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)
-)
-
 type GoogleMessage1 struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
diff --git a/internal/testprotos/benchmarks/datasets/google_message1/proto3/benchmark_message1_proto3.pb.go b/internal/testprotos/benchmarks/datasets/google_message1/proto3/benchmark_message1_proto3.pb.go
index 9e3f3c5..d7f93ca 100644
--- a/internal/testprotos/benchmarks/datasets/google_message1/proto3/benchmark_message1_proto3.pb.go
+++ b/internal/testprotos/benchmarks/datasets/google_message1/proto3/benchmark_message1_proto3.pb.go
@@ -12,13 +12,6 @@
 	sync "sync"
 )
 
-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)
-)
-
 type GoogleMessage1 struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
diff --git a/internal/testprotos/benchmarks/datasets/google_message2/benchmark_message2.pb.go b/internal/testprotos/benchmarks/datasets/google_message2/benchmark_message2.pb.go
index 2423705..fbc6fc3 100644
--- a/internal/testprotos/benchmarks/datasets/google_message2/benchmark_message2.pb.go
+++ b/internal/testprotos/benchmarks/datasets/google_message2/benchmark_message2.pb.go
@@ -12,13 +12,6 @@
 	sync "sync"
 )
 
-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)
-)
-
 type GoogleMessage2 struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
diff --git a/internal/testprotos/benchmarks/datasets/google_message3/benchmark_message3.pb.go b/internal/testprotos/benchmarks/datasets/google_message3/benchmark_message3.pb.go
index 8c0e4bb..cad680e 100644
--- a/internal/testprotos/benchmarks/datasets/google_message3/benchmark_message3.pb.go
+++ b/internal/testprotos/benchmarks/datasets/google_message3/benchmark_message3.pb.go
@@ -11,13 +11,6 @@
 	sync "sync"
 )
 
-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)
-)
-
 type GoogleMessage3 struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
diff --git a/internal/testprotos/benchmarks/datasets/google_message3/benchmark_message3_1.pb.go b/internal/testprotos/benchmarks/datasets/google_message3/benchmark_message3_1.pb.go
index 638b3f8..11a9f6e 100644
--- a/internal/testprotos/benchmarks/datasets/google_message3/benchmark_message3_1.pb.go
+++ b/internal/testprotos/benchmarks/datasets/google_message3/benchmark_message3_1.pb.go
@@ -11,13 +11,6 @@
 	sync "sync"
 )
 
-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)
-)
-
 type Message34390 struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
diff --git a/internal/testprotos/benchmarks/datasets/google_message3/benchmark_message3_2.pb.go b/internal/testprotos/benchmarks/datasets/google_message3/benchmark_message3_2.pb.go
index 2c9b224..ba58265 100644
--- a/internal/testprotos/benchmarks/datasets/google_message3/benchmark_message3_2.pb.go
+++ b/internal/testprotos/benchmarks/datasets/google_message3/benchmark_message3_2.pb.go
@@ -11,13 +11,6 @@
 	sync "sync"
 )
 
-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)
-)
-
 type Message22853 struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
diff --git a/internal/testprotos/benchmarks/datasets/google_message3/benchmark_message3_3.pb.go b/internal/testprotos/benchmarks/datasets/google_message3/benchmark_message3_3.pb.go
index 7e6639f..9bc9a05 100644
--- a/internal/testprotos/benchmarks/datasets/google_message3/benchmark_message3_3.pb.go
+++ b/internal/testprotos/benchmarks/datasets/google_message3/benchmark_message3_3.pb.go
@@ -10,13 +10,6 @@
 	sync "sync"
 )
 
-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)
-)
-
 type Message35546 struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
diff --git a/internal/testprotos/benchmarks/datasets/google_message3/benchmark_message3_4.pb.go b/internal/testprotos/benchmarks/datasets/google_message3/benchmark_message3_4.pb.go
index 7ed40ef..19354c8 100644
--- a/internal/testprotos/benchmarks/datasets/google_message3/benchmark_message3_4.pb.go
+++ b/internal/testprotos/benchmarks/datasets/google_message3/benchmark_message3_4.pb.go
@@ -11,13 +11,6 @@
 	sync "sync"
 )
 
-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)
-)
-
 type Message24346 struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
diff --git a/internal/testprotos/benchmarks/datasets/google_message3/benchmark_message3_5.pb.go b/internal/testprotos/benchmarks/datasets/google_message3/benchmark_message3_5.pb.go
index 6410504..d486bf2 100644
--- a/internal/testprotos/benchmarks/datasets/google_message3/benchmark_message3_5.pb.go
+++ b/internal/testprotos/benchmarks/datasets/google_message3/benchmark_message3_5.pb.go
@@ -11,13 +11,6 @@
 	sync "sync"
 )
 
-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)
-)
-
 type Message24377 struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
diff --git a/internal/testprotos/benchmarks/datasets/google_message3/benchmark_message3_6.pb.go b/internal/testprotos/benchmarks/datasets/google_message3/benchmark_message3_6.pb.go
index d9cbacf..4fb855f 100644
--- a/internal/testprotos/benchmarks/datasets/google_message3/benchmark_message3_6.pb.go
+++ b/internal/testprotos/benchmarks/datasets/google_message3/benchmark_message3_6.pb.go
@@ -11,13 +11,6 @@
 	sync "sync"
 )
 
-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)
-)
-
 type Message10576 struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
diff --git a/internal/testprotos/benchmarks/datasets/google_message3/benchmark_message3_7.pb.go b/internal/testprotos/benchmarks/datasets/google_message3/benchmark_message3_7.pb.go
index 45c13ed..6aaaa5f 100644
--- a/internal/testprotos/benchmarks/datasets/google_message3/benchmark_message3_7.pb.go
+++ b/internal/testprotos/benchmarks/datasets/google_message3/benchmark_message3_7.pb.go
@@ -10,13 +10,6 @@
 	sync "sync"
 )
 
-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)
-)
-
 type Message11018 struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
diff --git a/internal/testprotos/benchmarks/datasets/google_message3/benchmark_message3_8.pb.go b/internal/testprotos/benchmarks/datasets/google_message3/benchmark_message3_8.pb.go
index aa09f27..320fbd1 100644
--- a/internal/testprotos/benchmarks/datasets/google_message3/benchmark_message3_8.pb.go
+++ b/internal/testprotos/benchmarks/datasets/google_message3/benchmark_message3_8.pb.go
@@ -11,13 +11,6 @@
 	sync "sync"
 )
 
-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)
-)
-
 type Enum720 int32
 
 const (
diff --git a/internal/testprotos/benchmarks/datasets/google_message4/benchmark_message4.pb.go b/internal/testprotos/benchmarks/datasets/google_message4/benchmark_message4.pb.go
index 87bce1d..9406554 100644
--- a/internal/testprotos/benchmarks/datasets/google_message4/benchmark_message4.pb.go
+++ b/internal/testprotos/benchmarks/datasets/google_message4/benchmark_message4.pb.go
@@ -11,13 +11,6 @@
 	sync "sync"
 )
 
-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)
-)
-
 type GoogleMessage4 struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
diff --git a/internal/testprotos/benchmarks/datasets/google_message4/benchmark_message4_1.pb.go b/internal/testprotos/benchmarks/datasets/google_message4/benchmark_message4_1.pb.go
index f20d7ab..7403ce2 100644
--- a/internal/testprotos/benchmarks/datasets/google_message4/benchmark_message4_1.pb.go
+++ b/internal/testprotos/benchmarks/datasets/google_message4/benchmark_message4_1.pb.go
@@ -11,13 +11,6 @@
 	sync "sync"
 )
 
-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)
-)
-
 type Message2463 struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
diff --git a/internal/testprotos/benchmarks/datasets/google_message4/benchmark_message4_2.pb.go b/internal/testprotos/benchmarks/datasets/google_message4/benchmark_message4_2.pb.go
index 3ac63cb..d557ca2 100644
--- a/internal/testprotos/benchmarks/datasets/google_message4/benchmark_message4_2.pb.go
+++ b/internal/testprotos/benchmarks/datasets/google_message4/benchmark_message4_2.pb.go
@@ -10,13 +10,6 @@
 	sync "sync"
 )
 
-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)
-)
-
 type Message12774 struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
diff --git a/internal/testprotos/benchmarks/datasets/google_message4/benchmark_message4_3.pb.go b/internal/testprotos/benchmarks/datasets/google_message4/benchmark_message4_3.pb.go
index 05c4de4..2d2e75f 100644
--- a/internal/testprotos/benchmarks/datasets/google_message4/benchmark_message4_3.pb.go
+++ b/internal/testprotos/benchmarks/datasets/google_message4/benchmark_message4_3.pb.go
@@ -11,13 +11,6 @@
 	sync "sync"
 )
 
-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)
-)
-
 type UnusedEnum int32
 
 const (
diff --git a/internal/testprotos/conformance/conformance.pb.go b/internal/testprotos/conformance/conformance.pb.go
index a6defde..b1e4da8 100644
--- a/internal/testprotos/conformance/conformance.pb.go
+++ b/internal/testprotos/conformance/conformance.pb.go
@@ -41,13 +41,6 @@
 	sync "sync"
 )
 
-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)
-)
-
 type WireFormat int32
 
 const (
diff --git a/internal/testprotos/conformance/test_messages_proto2.pb.go b/internal/testprotos/conformance/test_messages_proto2.pb.go
index 9b6f78e..f8a233a 100644
--- a/internal/testprotos/conformance/test_messages_proto2.pb.go
+++ b/internal/testprotos/conformance/test_messages_proto2.pb.go
@@ -47,13 +47,6 @@
 	sync "sync"
 )
 
-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)
-)
-
 type ForeignEnumProto2 int32
 
 const (
diff --git a/internal/testprotos/conformance/test_messages_proto3.pb.go b/internal/testprotos/conformance/test_messages_proto3.pb.go
index 0e45cb4..c583158 100644
--- a/internal/testprotos/conformance/test_messages_proto3.pb.go
+++ b/internal/testprotos/conformance/test_messages_proto3.pb.go
@@ -54,13 +54,6 @@
 	sync "sync"
 )
 
-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)
-)
-
 type ForeignEnum int32
 
 const (
diff --git a/internal/testprotos/irregular/test.pb.go b/internal/testprotos/irregular/test.pb.go
index a63ca77..31f1e11 100644
--- a/internal/testprotos/irregular/test.pb.go
+++ b/internal/testprotos/irregular/test.pb.go
@@ -18,13 +18,6 @@
 	sync "sync"
 )
 
-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)
-)
-
 type Message struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
diff --git a/internal/testprotos/legacy/legacy.pb.go b/internal/testprotos/legacy/legacy.pb.go
index 3f8efea..db77985 100644
--- a/internal/testprotos/legacy/legacy.pb.go
+++ b/internal/testprotos/legacy/legacy.pb.go
@@ -26,13 +26,6 @@
 	sync "sync"
 )
 
-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)
-)
-
 type Legacy struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
diff --git a/internal/testprotos/messageset/messagesetpb/message_set.pb.go b/internal/testprotos/messageset/messagesetpb/message_set.pb.go
index 4e3ea38..b2199ca 100644
--- a/internal/testprotos/messageset/messagesetpb/message_set.pb.go
+++ b/internal/testprotos/messageset/messagesetpb/message_set.pb.go
@@ -15,13 +15,6 @@
 	sync "sync"
 )
 
-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)
-)
-
 type MessageSet struct {
 	state           protoimpl.MessageState
 	sizeCache       protoimpl.SizeCache
diff --git a/internal/testprotos/messageset/msetextpb/msetextpb.pb.go b/internal/testprotos/messageset/msetextpb/msetextpb.pb.go
index be50f98..21715b0 100644
--- a/internal/testprotos/messageset/msetextpb/msetextpb.pb.go
+++ b/internal/testprotos/messageset/msetextpb/msetextpb.pb.go
@@ -16,13 +16,6 @@
 	sync "sync"
 )
 
-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)
-)
-
 type Ext1 struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
diff --git a/internal/testprotos/test/ext.pb.go b/internal/testprotos/test/ext.pb.go
index 395ce91..bbb124a 100644
--- a/internal/testprotos/test/ext.pb.go
+++ b/internal/testprotos/test/ext.pb.go
@@ -15,13 +15,6 @@
 	sync "sync"
 )
 
-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{
 	{
 		ExtendedType:  (*TestAllExtensions)(nil),
diff --git a/internal/testprotos/test/test.pb.go b/internal/testprotos/test/test.pb.go
index 9f5b4cd..5e04009 100644
--- a/internal/testprotos/test/test.pb.go
+++ b/internal/testprotos/test/test.pb.go
@@ -16,13 +16,6 @@
 	sync "sync"
 )
 
-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)
-)
-
 type ForeignEnum int32
 
 const (
diff --git a/internal/testprotos/test/test_import.pb.go b/internal/testprotos/test/test_import.pb.go
index 153681f..d1cdcb5 100644
--- a/internal/testprotos/test/test_import.pb.go
+++ b/internal/testprotos/test/test_import.pb.go
@@ -15,13 +15,6 @@
 	sync "sync"
 )
 
-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)
-)
-
 type ImportEnum int32
 
 const (
diff --git a/internal/testprotos/test/test_public.pb.go b/internal/testprotos/test/test_public.pb.go
index 79eec41..f694f37 100644
--- a/internal/testprotos/test/test_public.pb.go
+++ b/internal/testprotos/test/test_public.pb.go
@@ -14,13 +14,6 @@
 	sync "sync"
 )
 
-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)
-)
-
 type PublicImportMessage struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
diff --git a/internal/testprotos/test/weak1/test_weak.pb.go b/internal/testprotos/test/weak1/test_weak.pb.go
index 07d4301..1f43692 100644
--- a/internal/testprotos/test/weak1/test_weak.pb.go
+++ b/internal/testprotos/test/weak1/test_weak.pb.go
@@ -14,13 +14,6 @@
 	sync "sync"
 )
 
-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)
-)
-
 type WeakImportMessage1 struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
diff --git a/internal/testprotos/test/weak2/test_weak.pb.go b/internal/testprotos/test/weak2/test_weak.pb.go
index 6a23155..4105754 100644
--- a/internal/testprotos/test/weak2/test_weak.pb.go
+++ b/internal/testprotos/test/weak2/test_weak.pb.go
@@ -14,13 +14,6 @@
 	sync "sync"
 )
 
-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)
-)
-
 type WeakImportMessage2 struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
diff --git a/internal/testprotos/test3/test.pb.go b/internal/testprotos/test3/test.pb.go
index b5d340d..b52ebf0 100644
--- a/internal/testprotos/test3/test.pb.go
+++ b/internal/testprotos/test3/test.pb.go
@@ -15,13 +15,6 @@
 	sync "sync"
 )
 
-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)
-)
-
 type ForeignEnum int32
 
 const (
diff --git a/internal/testprotos/test3/test_import.pb.go b/internal/testprotos/test3/test_import.pb.go
index cff01bb..3c24da6 100644
--- a/internal/testprotos/test3/test_import.pb.go
+++ b/internal/testprotos/test3/test_import.pb.go
@@ -15,13 +15,6 @@
 	sync "sync"
 )
 
-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)
-)
-
 type ImportEnum int32
 
 const (