mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2025-01-27 12:35:21 +00:00
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>
This commit is contained in:
parent
8d5e6d6927
commit
bab3d4084e
@ -14,13 +14,6 @@ import (
|
||||
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_grpc_deprecation_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_grpc_deprecation_proto_rawDesc = []byte{
|
||||
|
@ -14,13 +14,6 @@ import (
|
||||
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 Request struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -11,6 +11,7 @@ import (
|
||||
"go/parser"
|
||||
"go/token"
|
||||
"math"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"unicode"
|
||||
@ -25,6 +26,9 @@ import (
|
||||
"google.golang.org/protobuf/types/descriptorpb"
|
||||
)
|
||||
|
||||
// GenerateVersionMarkers specifies whether to generate version markers.
|
||||
var GenerateVersionMarkers = true
|
||||
|
||||
const (
|
||||
// generateEnumJSONMethods specifies whether to generate the UnmarshalJSON
|
||||
// method for proto2 enums.
|
||||
@ -145,28 +149,21 @@ func GenerateFile(gen *protogen.Plugin, file *protogen.File) *protogen.Generated
|
||||
}
|
||||
|
||||
genStandaloneComments(g, f, fieldnum.FileDescriptorProto_Syntax)
|
||||
|
||||
g.P("// Code generated by protoc-gen-go. DO NOT EDIT.")
|
||||
if f.Proto.GetOptions().GetDeprecated() {
|
||||
g.P("// ", f.Desc.Path(), " is a deprecated file.")
|
||||
} else {
|
||||
g.P("// source: ", f.Desc.Path())
|
||||
}
|
||||
g.P()
|
||||
|
||||
genGeneratedHeader(gen, g, f)
|
||||
genStandaloneComments(g, f, fieldnum.FileDescriptorProto_Package)
|
||||
|
||||
g.P("package ", f.GoPackageName)
|
||||
g.P()
|
||||
|
||||
// Emit a static check that enforces a minimum version of the proto package.
|
||||
g.P("const (")
|
||||
g.P("// Verify that runtime/protoimpl is sufficiently up-to-date.")
|
||||
g.P("_ = ", protoimplPackage.Ident("EnforceVersion"), "(", protoimplPackage.Ident("MaxVersion"), " - ", protoimpl.Version, ")")
|
||||
g.P("// Verify that this generated code is sufficiently up-to-date.")
|
||||
g.P("_ = ", protoimplPackage.Ident("EnforceVersion"), "(", protoimpl.Version, " - ", protoimplPackage.Ident("MinVersion"), ")")
|
||||
g.P(")")
|
||||
g.P()
|
||||
if GenerateVersionMarkers {
|
||||
g.P("const (")
|
||||
g.P("// Verify that this generated code is sufficiently up-to-date.")
|
||||
g.P("_ = ", protoimplPackage.Ident("EnforceVersion"), "(", protoimpl.GenVersion, " - ", protoimplPackage.Ident("MinVersion"), ")")
|
||||
g.P("// Verify that runtime/protoimpl is sufficiently up-to-date.")
|
||||
g.P("_ = ", protoimplPackage.Ident("EnforceVersion"), "(", protoimplPackage.Ident("MaxVersion"), " - ", protoimpl.GenVersion, ")")
|
||||
g.P(")")
|
||||
g.P()
|
||||
}
|
||||
|
||||
for i, imps := 0, f.Desc.Imports(); i < imps.Len(); i++ {
|
||||
genImport(gen, g, f, imps.Get(i))
|
||||
@ -209,6 +206,33 @@ func genStandaloneComments(g *protogen.GeneratedFile, f *fileInfo, n int32) {
|
||||
}
|
||||
}
|
||||
|
||||
func genGeneratedHeader(gen *protogen.Plugin, g *protogen.GeneratedFile, f *fileInfo) {
|
||||
g.P("// Code generated by protoc-gen-go. DO NOT EDIT.")
|
||||
|
||||
if GenerateVersionMarkers {
|
||||
g.P("// versions:")
|
||||
protocGenGoVersion := protoimpl.VersionString()
|
||||
protocVersion := "(unknown)"
|
||||
if v := gen.Request.GetCompilerVersion(); v != nil {
|
||||
protocVersion = fmt.Sprintf("v%v.%v.%v", v.GetMajor(), v.GetMinor(), v.GetPatch())
|
||||
}
|
||||
goVersion := runtime.Version()
|
||||
if strings.HasPrefix(goVersion, "go") {
|
||||
goVersion = "v" + goVersion[len("go"):]
|
||||
}
|
||||
g.P("// \tprotoc-gen-go ", protocGenGoVersion)
|
||||
g.P("// \tprotoc ", protocVersion)
|
||||
g.P("// \tgo ", goVersion)
|
||||
}
|
||||
|
||||
if f.Proto.GetOptions().GetDeprecated() {
|
||||
g.P("// ", f.Desc.Path(), " is a deprecated file.")
|
||||
} else {
|
||||
g.P("// source: ", f.Desc.Path())
|
||||
}
|
||||
g.P()
|
||||
}
|
||||
|
||||
func genImport(gen *protogen.Plugin, g *protogen.GeneratedFile, f *fileInfo, imp protoreflect.FileImport) {
|
||||
impFile, ok := gen.FileByName(imp.Path())
|
||||
if !ok {
|
||||
|
@ -9,12 +9,21 @@ package main
|
||||
import (
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
gengo "google.golang.org/protobuf/cmd/protoc-gen-go/internal_gengo"
|
||||
"google.golang.org/protobuf/compiler/protogen"
|
||||
"google.golang.org/protobuf/runtime/protoimpl"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if len(os.Args) == 2 && os.Args[1] == "--version" {
|
||||
fmt.Fprintf(os.Stderr, "%v %v\n", filepath.Base(os.Args[0]), protoimpl.VersionString())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
var (
|
||||
flags flag.FlagSet
|
||||
plugins = flags.String("plugins", "", "deprecated option")
|
||||
|
@ -15,13 +15,6 @@ import (
|
||||
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 AnnotationsTestEnum int32
|
||||
|
||||
const (
|
||||
|
@ -1 +1 @@
|
||||
annotation:{path:5 path:0 source_file:"annotations/annotations.proto" begin:750 end:769} annotation:{path:5 path:0 path:2 path:0 source_file:"annotations/annotations.proto" begin:786 end:833} annotation:{path:4 path:0 source_file:"annotations/annotations.proto" begin:2113 end:2135} annotation:{path:4 path:0 path:2 path:0 source_file:"annotations/annotations.proto" begin:2259 end:2279} annotation:{path:4 path:0 path:2 path:0 source_file:"annotations/annotations.proto" begin:3173 end:3196}
|
||||
annotation:{path:5 path:0 source_file:"annotations/annotations.proto" begin:501 end:520} annotation:{path:5 path:0 path:2 path:0 source_file:"annotations/annotations.proto" begin:537 end:584} annotation:{path:4 path:0 source_file:"annotations/annotations.proto" begin:1864 end:1886} annotation:{path:4 path:0 path:2 path:0 source_file:"annotations/annotations.proto" begin:2010 end:2030} annotation:{path:4 path:0 path:2 path:0 source_file:"annotations/annotations.proto" begin:2924 end:2947}
|
@ -18,13 +18,6 @@ import (
|
||||
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)
|
||||
)
|
||||
|
||||
// COMMENT: Enum1.Leading
|
||||
type Enum1 int32
|
||||
|
||||
|
@ -15,13 +15,6 @@ import (
|
||||
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)
|
||||
)
|
||||
|
||||
// Deprecated: Do not use.
|
||||
type DeprecatedEnum int32
|
||||
|
||||
|
@ -15,13 +15,6 @@ import (
|
||||
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 BaseMessage struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -18,13 +18,6 @@ import (
|
||||
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 Enum int32
|
||||
|
||||
const (
|
||||
|
@ -14,13 +14,6 @@ import (
|
||||
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 ExtraMessage struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -17,13 +17,6 @@ import (
|
||||
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 Enum int32
|
||||
|
||||
const (
|
||||
|
@ -14,13 +14,6 @@ import (
|
||||
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)
|
||||
)
|
||||
|
||||
// Assorted edge cases in field name conflict resolution.
|
||||
//
|
||||
// Not all (or possibly any) of these behave in an easily-understood fashion.
|
||||
|
@ -15,13 +15,6 @@ import (
|
||||
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)
|
||||
)
|
||||
|
||||
// Symbols defined in public import of import_public/sub/a.proto.
|
||||
|
||||
type E = sub.E
|
||||
|
@ -15,13 +15,6 @@ import (
|
||||
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 Local struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -15,13 +15,6 @@ import (
|
||||
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 UsingPublicImport struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -18,13 +18,6 @@ import (
|
||||
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)
|
||||
)
|
||||
|
||||
// Symbols defined in public import of import_public/sub2/a.proto.
|
||||
|
||||
type Sub2Message = sub2.Sub2Message
|
||||
|
@ -14,13 +14,6 @@ import (
|
||||
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 M2 struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -14,13 +14,6 @@ import (
|
||||
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 Sub2Message struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -14,13 +14,6 @@ import (
|
||||
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 M struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -15,13 +15,6 @@ import (
|
||||
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 E1 int32
|
||||
|
||||
const (
|
||||
|
@ -14,13 +14,6 @@ import (
|
||||
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 M2 struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -14,13 +14,6 @@ import (
|
||||
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 M3 struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -14,13 +14,6 @@ import (
|
||||
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 M4 struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -14,13 +14,6 @@ import (
|
||||
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 M1 struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -14,13 +14,6 @@ import (
|
||||
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 M2 struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -15,13 +15,6 @@ import (
|
||||
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 A1M1 struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -15,13 +15,6 @@ import (
|
||||
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 A1M2 struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -18,13 +18,6 @@ import (
|
||||
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 All struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -10,13 +10,6 @@ import (
|
||||
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 Foo struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -15,13 +15,6 @@ import (
|
||||
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 Enum int32
|
||||
|
||||
const (
|
||||
|
7
cmd/protoc-gen-go/testdata/proto2/enum.pb.go
vendored
7
cmd/protoc-gen-go/testdata/proto2/enum.pb.go
vendored
@ -15,13 +15,6 @@ import (
|
||||
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)
|
||||
)
|
||||
|
||||
// EnumType1 comment.
|
||||
type EnumType1 int32
|
||||
|
||||
|
@ -16,13 +16,6 @@ import (
|
||||
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 FieldTestMessage_Enum int32
|
||||
|
||||
const (
|
||||
|
@ -14,13 +14,6 @@ import (
|
||||
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 Layer1 struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -14,13 +14,6 @@ import (
|
||||
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
|
||||
|
7
cmd/protoc-gen-go/testdata/proto3/enum.pb.go
vendored
7
cmd/protoc-gen-go/testdata/proto3/enum.pb.go
vendored
@ -15,13 +15,6 @@ import (
|
||||
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 Enum int32
|
||||
|
||||
const (
|
||||
|
@ -15,13 +15,6 @@ import (
|
||||
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 FieldTestMessage_Enum int32
|
||||
|
||||
const (
|
||||
|
@ -25,13 +25,6 @@ import (
|
||||
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 Enum int32
|
||||
|
||||
const (
|
||||
|
@ -17,13 +17,6 @@ import (
|
||||
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 Enum int32
|
||||
|
||||
const (
|
||||
|
@ -53,6 +53,7 @@ func init() {
|
||||
if file.Generate {
|
||||
switch plugin {
|
||||
case "go":
|
||||
gengo.GenerateVersionMarkers = false
|
||||
gengo.GenerateFile(gen, file)
|
||||
generateFieldNumbers(gen, file)
|
||||
case "gogrpc":
|
||||
|
@ -40,13 +40,6 @@ import (
|
||||
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
|
||||
|
@ -12,13 +12,6 @@ import (
|
||||
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
|
||||
|
@ -12,13 +12,6 @@ import (
|
||||
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
|
||||
|
@ -12,13 +12,6 @@ import (
|
||||
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
|
||||
|
@ -11,13 +11,6 @@ import (
|
||||
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
|
||||
|
@ -11,13 +11,6 @@ import (
|
||||
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
|
||||
|
@ -11,13 +11,6 @@ import (
|
||||
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
|
||||
|
@ -10,13 +10,6 @@ import (
|
||||
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
|
||||
|
@ -11,13 +11,6 @@ import (
|
||||
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
|
||||
|
@ -11,13 +11,6 @@ import (
|
||||
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
|
||||
|
@ -11,13 +11,6 @@ import (
|
||||
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
|
||||
|
@ -10,13 +10,6 @@ import (
|
||||
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
|
||||
|
@ -11,13 +11,6 @@ import (
|
||||
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 (
|
||||
|
@ -11,13 +11,6 @@ import (
|
||||
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
|
||||
|
@ -11,13 +11,6 @@ import (
|
||||
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
|
||||
|
@ -10,13 +10,6 @@ import (
|
||||
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
|
||||
|
@ -11,13 +11,6 @@ import (
|
||||
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 (
|
||||
|
@ -41,13 +41,6 @@ import (
|
||||
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 (
|
||||
|
@ -47,13 +47,6 @@ import (
|
||||
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 (
|
||||
|
@ -54,13 +54,6 @@ import (
|
||||
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 (
|
||||
|
@ -18,13 +18,6 @@ import (
|
||||
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
|
||||
|
@ -26,13 +26,6 @@ import (
|
||||
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
|
||||
|
@ -15,13 +15,6 @@ import (
|
||||
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
|
||||
|
@ -16,13 +16,6 @@ import (
|
||||
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
|
||||
|
@ -15,13 +15,6 @@ import (
|
||||
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),
|
||||
|
@ -16,13 +16,6 @@ import (
|
||||
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 (
|
||||
|
@ -15,13 +15,6 @@ import (
|
||||
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 (
|
||||
|
@ -14,13 +14,6 @@ import (
|
||||
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
|
||||
|
@ -14,13 +14,6 @@ import (
|
||||
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
|
||||
|
@ -14,13 +14,6 @@ import (
|
||||
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
|
||||
|
@ -15,13 +15,6 @@ import (
|
||||
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 (
|
||||
|
@ -15,13 +15,6 @@ import (
|
||||
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 (
|
||||
|
@ -18,13 +18,6 @@ import (
|
||||
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 Enum1 int32
|
||||
|
||||
const (
|
||||
|
@ -17,51 +17,10 @@ import (
|
||||
"google.golang.org/protobuf/internal/impl"
|
||||
)
|
||||
|
||||
const (
|
||||
// MaxVersion is the maximum supported version for generated .pb.go files;
|
||||
// which is the current version of the package.
|
||||
// This is incremented when the functionality of this package expands.
|
||||
MaxVersion = 0
|
||||
|
||||
// MinVersion is the minimum supported version for generated .pb.go files.
|
||||
// This is incremented when the runtime drops support for old code.
|
||||
MinVersion = 0
|
||||
|
||||
// Version is the current minor version of the runtime.
|
||||
Version = MaxVersion // v2.{Version}.x
|
||||
|
||||
// TODO: Encode a date instead of the minor version?
|
||||
)
|
||||
|
||||
// UnsafeEnabled specifies whether package unsafe can be used.
|
||||
const UnsafeEnabled = impl.UnsafeEnabled
|
||||
|
||||
type (
|
||||
// EnforceVersion is used by code generated by protoc-gen-go
|
||||
// to statically enforce minimum and maximum versions of this package.
|
||||
// A compilation failure implies either that:
|
||||
// * the runtime package is too old and needs to be updated OR
|
||||
// * the generated code is too old and needs to be regenerated.
|
||||
//
|
||||
// The runtime package can be upgraded by running:
|
||||
// go get google.golang.org/protobuf
|
||||
//
|
||||
// The generated code can be regenerated by running:
|
||||
// protoc --go_out=${PROTOC_GEN_GO_ARGS} ${PROTO_FILES}
|
||||
//
|
||||
// Example usage by generated code:
|
||||
// const (
|
||||
// // Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
// _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - genVersion)
|
||||
// // Verify that this generated code is sufficiently up-to-date.
|
||||
// _ = protoimpl.EnforceVersion(genVersion - protoimpl.MinVersion)
|
||||
// )
|
||||
//
|
||||
// The genVersion is the current version used to generated the code.
|
||||
// This compile-time check relies on negative integer overflow of a uint
|
||||
// being a compilation failure (guaranteed by the Go specification).
|
||||
EnforceVersion uint
|
||||
|
||||
DescBuilder = filedesc.Builder
|
||||
TypeBuilder = filetype.Builder
|
||||
Pointer = impl.Pointer
|
||||
|
125
runtime/protoimpl/version.go
Normal file
125
runtime/protoimpl/version.go
Normal file
@ -0,0 +1,125 @@
|
||||
// Copyright 2019 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package protoimpl
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// These constants determine the current version of this module.
|
||||
//
|
||||
//
|
||||
// For our release process, we enforce the following rules:
|
||||
// * Tagged releases use a tag that is identical to VersionString.
|
||||
// * Tagged releases never reference a commit where the VersionString
|
||||
// contains "devel".
|
||||
// * The set of all commits in this repository where VersionString
|
||||
// does not contain "devel" must have a unique VersionString.
|
||||
//
|
||||
//
|
||||
// Steps for tagging a new release:
|
||||
// 1. Create a new CL.
|
||||
//
|
||||
// 2. Update versionMinor, versionPatch, and/or versionPreRelease as necessary.
|
||||
// versionPreRelease must not contain the string "devel".
|
||||
//
|
||||
// 3. Since the last released minor version, have there been any changes to
|
||||
// generator that relies on new functionality in the runtime?
|
||||
// If yes, then increment GenVersion.
|
||||
//
|
||||
// 4. Since the last released minor version, have there been any changes to
|
||||
// the runtime that removes support for old .pb.go source code?
|
||||
// If yes, then increment MinVersion.
|
||||
//
|
||||
// 5. Send out the CL for review and submit it.
|
||||
// Note that the next CL in step 8 must be submitted after this CL
|
||||
// without any other CLs in-between.
|
||||
//
|
||||
// 6. Tag a new version, where the tag is is the current VersionString.
|
||||
//
|
||||
// 7. Write release notes for all notable changes
|
||||
// between this release and the last release.
|
||||
//
|
||||
// 8. Create a new CL.
|
||||
//
|
||||
// 9. Update versionPreRelease to include the string "devel".
|
||||
// For example: "" -> "devel" or "rc.1" -> "rc.1.devel"
|
||||
//
|
||||
// 10. Send out the CL for review and submit it.
|
||||
const (
|
||||
versionMajor = 1
|
||||
versionMinor = 19
|
||||
versionPatch = 0
|
||||
versionPreRelease = "devel"
|
||||
)
|
||||
|
||||
// VersionString formats the version string for this module in semver format.
|
||||
//
|
||||
// Examples:
|
||||
// v1.20.1
|
||||
// v1.21.0-rc.1
|
||||
func VersionString() string {
|
||||
v := fmt.Sprintf("v%d.%d.%d", versionMajor, versionMinor, versionPatch)
|
||||
if versionPreRelease != "" {
|
||||
v += "-" + versionPreRelease
|
||||
|
||||
// TODO: Add metadata about the commit or build hash.
|
||||
// See https://golang.org/issue/29814
|
||||
// See https://golang.org/issue/33533
|
||||
var versionMetadata string
|
||||
if strings.Contains(versionPreRelease, "devel") && versionMetadata != "" {
|
||||
v += "+" + versionMetadata
|
||||
}
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
const (
|
||||
// MaxVersion is the maximum supported version for generated .pb.go files.
|
||||
// It is always the current version of the module.
|
||||
MaxVersion = versionMinor
|
||||
|
||||
// GenVersion is the runtime version required by generated .pb.go files.
|
||||
// This is incremented when generated code relies on new functionality
|
||||
// in the runtime.
|
||||
GenVersion = 19
|
||||
|
||||
// MinVersion is the minimum supported version for generated .pb.go files.
|
||||
// This is incremented when the runtime drops support for old code.
|
||||
MinVersion = 0
|
||||
)
|
||||
|
||||
// EnforceVersion is used by code generated by protoc-gen-go
|
||||
// to statically enforce minimum and maximum versions of this package.
|
||||
// A compilation failure implies either that:
|
||||
// * the runtime package is too old and needs to be updated OR
|
||||
// * the generated code is too old and needs to be regenerated.
|
||||
//
|
||||
// The runtime package can be upgraded by running:
|
||||
// go get google.golang.org/protobuf
|
||||
//
|
||||
// The generated code can be regenerated by running:
|
||||
// protoc --go_out=${PROTOC_GEN_GO_ARGS} ${PROTO_FILES}
|
||||
//
|
||||
// Example usage by generated code:
|
||||
// const (
|
||||
// // Verify that this generated code is sufficiently up-to-date.
|
||||
// _ = protoimpl.EnforceVersion(genVersion - protoimpl.MinVersion)
|
||||
// // Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
// _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - genVersion)
|
||||
// )
|
||||
//
|
||||
// The genVersion is the current minor version used to generated the code.
|
||||
// This compile-time check relies on negative integer overflow of a uint
|
||||
// being a compilation failure (guaranteed by the Go specification).
|
||||
type EnforceVersion uint
|
||||
|
||||
// This enforces the following invariant:
|
||||
// MinVersion ≤ GenVersion ≤ MaxVersion
|
||||
const (
|
||||
_ = EnforceVersion(GenVersion - MinVersion)
|
||||
_ = EnforceVersion(MaxVersion - GenVersion)
|
||||
)
|
@ -50,13 +50,6 @@ import (
|
||||
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 FieldDescriptorProto_Type int32
|
||||
|
||||
const (
|
||||
|
@ -40,13 +40,6 @@ import (
|
||||
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)
|
||||
)
|
||||
|
||||
// `Any` contains an arbitrary serialized protocol buffer message along with a
|
||||
// URL that describes the type of the serialized message.
|
||||
//
|
||||
|
@ -42,13 +42,6 @@ import (
|
||||
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)
|
||||
)
|
||||
|
||||
// Api is a light-weight descriptor for an API Interface.
|
||||
//
|
||||
// Interfaces are also described as "protocol buffer services" in some contexts,
|
||||
|
@ -40,13 +40,6 @@ import (
|
||||
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)
|
||||
)
|
||||
|
||||
// A Duration represents a signed, fixed-length span of time represented
|
||||
// as a count of seconds and fractions of seconds at nanosecond
|
||||
// resolution. It is independent of any calendar and concepts like "day"
|
||||
|
@ -40,13 +40,6 @@ import (
|
||||
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)
|
||||
)
|
||||
|
||||
// A generic empty message that you can re-use to avoid defining duplicated
|
||||
// empty messages in your APIs. A typical example is to use it as the request
|
||||
// or the response type of an API method. For instance:
|
||||
|
@ -40,13 +40,6 @@ import (
|
||||
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)
|
||||
)
|
||||
|
||||
// `FieldMask` represents a set of symbolic field paths, for example:
|
||||
//
|
||||
// paths: "f.a"
|
||||
|
@ -40,13 +40,6 @@ import (
|
||||
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)
|
||||
)
|
||||
|
||||
// `SourceContext` represents information about the source of a
|
||||
// protobuf element, like the file in which it is defined.
|
||||
type SourceContext struct {
|
||||
|
@ -41,13 +41,6 @@ import (
|
||||
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)
|
||||
)
|
||||
|
||||
// `NullValue` is a singleton enumeration to represent the null value for the
|
||||
// `Value` type union.
|
||||
//
|
||||
|
@ -40,13 +40,6 @@ import (
|
||||
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)
|
||||
)
|
||||
|
||||
// A Timestamp represents a point in time independent of any time zone or local
|
||||
// calendar, encoded as a count of seconds and fractions of seconds at
|
||||
// nanosecond resolution. The count is relative to an epoch at UTC midnight on
|
||||
|
@ -43,13 +43,6 @@ import (
|
||||
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)
|
||||
)
|
||||
|
||||
// The syntax in which a protocol buffer element is defined.
|
||||
type Syntax int32
|
||||
|
||||
|
@ -50,13 +50,6 @@ import (
|
||||
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)
|
||||
)
|
||||
|
||||
// Wrapper message for `double`.
|
||||
//
|
||||
// The JSON representation for `DoubleValue` is JSON number.
|
||||
|
@ -57,13 +57,6 @@ import (
|
||||
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)
|
||||
)
|
||||
|
||||
// The version number of protocol compiler.
|
||||
type Version struct {
|
||||
state protoimpl.MessageState
|
||||
|
Loading…
x
Reference in New Issue
Block a user