reflect/protoregistry: add conflict override
The ignoreConflict function provides the ability to ignore certain conflicts.
By default, all conflicts are ignored with a log message produced instead.
Change-Id: I67fe56eef492e12421e5c8cb8d618dc2a46c82ed
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/186658
Reviewed-by: Damien Neil <dneil@google.com>
diff --git a/internal/filedesc/build.go b/internal/filedesc/build.go
index 52cbdf1..427e26e 100644
--- a/internal/filedesc/build.go
+++ b/internal/filedesc/build.go
@@ -6,8 +6,6 @@
package filedesc
import (
- "log"
-
"google.golang.org/protobuf/internal/encoding/wire"
"google.golang.org/protobuf/internal/fieldnum"
"google.golang.org/protobuf/reflect/protoreflect"
@@ -107,7 +105,7 @@
out.Services = fd.allServices
if err := db.FileRegistry.Register(fd); err != nil {
- CheckRegistryError(err)
+ panic(err)
}
return out
}
@@ -152,13 +150,3 @@
}
}
}
-
-// CheckRegistryError handles registration errors.
-// It is a variable so that its behavior can be replaced in another source file.
-var CheckRegistryError = func(err error) {
- log.Printf(""+
- "WARNING: %v\n"+
- "A future release will panic on registration conflicts.\n"+
- // TODO: Add a URL pointing to documentation on how to resolve conflicts.
- "\n", err)
-}