impl.go 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // Copyright 2018 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Package protoimpl contains the default implementation for messages
  5. // generated by protoc-gen-go.
  6. //
  7. // WARNING: This package should only ever be imported by generated messages.
  8. // The compatibility agreement covers nothing except for functionality needed
  9. // to keep existing generated messages operational. Breakages that occur due
  10. // to unauthorized usages of this package are not the author's responsibility.
  11. package protoimpl
  12. import (
  13. "google.golang.org/protobuf/internal/fileinit"
  14. "google.golang.org/protobuf/internal/impl"
  15. )
  16. const (
  17. // MaxVersion is the maximum supported version for generated .pb.go files;
  18. // which is the current version of the package.
  19. // This is incremented when the functionality of this package expands.
  20. MaxVersion = 0
  21. // MinVersion is the minimum supported version for generated .pb.go files.
  22. // This is incremented when the runtime drops support for old code.
  23. MinVersion = 0
  24. // Version is the current minor version of the runtime.
  25. Version = MaxVersion // v2.{Version}.x
  26. // TODO: Encode a date instead of the minor version?
  27. )
  28. type (
  29. // EnforceVersion is used by code generated by protoc-gen-go
  30. // to statically enforce minimum and maximum versions of this package.
  31. // A compilation failure implies either that:
  32. // * the runtime package is too old and needs to be updated OR
  33. // * the generated code is too old and needs to be regenerated.
  34. //
  35. // The runtime package can be upgraded by running:
  36. // go get google.golang.org/protobuf
  37. //
  38. // The generated code can be regenerated by running:
  39. // protoc --go_out=${PROTOC_GEN_GO_ARGS} ${PROTO_FILES}
  40. //
  41. // Example usage by generated code:
  42. // const (
  43. // // Verify that runtime/protoimpl is sufficiently up-to-date.
  44. // _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - genVersion)
  45. // // Verify that this generated code is sufficiently up-to-date.
  46. // _ = protoimpl.EnforceVersion(genVersion - protoimpl.MinVersion)
  47. // )
  48. //
  49. // The genVersion is the current version used to generated the code.
  50. // This compile-time check relies on negative integer overflow of a uint
  51. // being a compilation failure (guaranteed by the Go specification).
  52. EnforceVersion uint
  53. FileBuilder = fileinit.FileBuilder
  54. MessageInfo = impl.MessageInfo
  55. SizeCache = impl.SizeCache
  56. UnknownFields = impl.UnknownFields
  57. ExtensionFields = impl.ExtensionFields
  58. ExtensionFieldV1 = impl.ExtensionField
  59. )
  60. var X impl.Export