Damien Neil 162c12703c protogen: generate .meta file with code annotations
When the generator parameter 'annotate_code' is provided, generate a .meta
file containing a GeneratedCodeInfo message describing the generated code's
relation to the source .proto file.

Annotations are added with (*protogen.GeneratedFile).Annotate, which takes the
name of a Go identifier (e.g., "SomeMessage" or "SomeMessage.GetField") and an
associated source location. The generator examines the generated AST to
determine source offsets for the symbols.

Change the []int32 "Path" in protogen types to a "Location", which also captures
the source file name.

Change-Id: Icd2340875831f40a1f91d495e3bd7ea381475c77
Reviewed-on: https://go-review.googlesource.com/c/139759
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2018-10-16 17:22:41 +00:00

122 lines
4.5 KiB
Go

// Code generated by protoc-gen-go. DO NOT EDIT.
// source: annotations/annotations.proto
package annotations
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
type AnnotationsTestEnum int32
const (
AnnotationsTestEnum_ANNOTATIONS_TEST_ENUM_VALUE AnnotationsTestEnum = 0
)
var AnnotationsTestEnum_name = map[int32]string{
0: "ANNOTATIONS_TEST_ENUM_VALUE",
}
var AnnotationsTestEnum_value = map[string]int32{
"ANNOTATIONS_TEST_ENUM_VALUE": 0,
}
func (x AnnotationsTestEnum) Enum() *AnnotationsTestEnum {
p := new(AnnotationsTestEnum)
*p = x
return p
}
func (x AnnotationsTestEnum) String() string {
return proto.EnumName(AnnotationsTestEnum_name, int32(x))
}
func (x *AnnotationsTestEnum) UnmarshalJSON(data []byte) error {
value, err := proto.UnmarshalJSONEnum(AnnotationsTestEnum_value, data, "AnnotationsTestEnum")
if err != nil {
return err
}
*x = AnnotationsTestEnum(value)
return nil
}
func (AnnotationsTestEnum) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_21dfaf6fd39fa3b7, []int{0}
}
type AnnotationsTestMessage struct {
AnnotationsTestField *string `protobuf:"bytes,1,opt,name=AnnotationsTestField" json:"AnnotationsTestField,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *AnnotationsTestMessage) Reset() { *m = AnnotationsTestMessage{} }
func (m *AnnotationsTestMessage) String() string { return proto.CompactTextString(m) }
func (*AnnotationsTestMessage) ProtoMessage() {}
func (*AnnotationsTestMessage) Descriptor() ([]byte, []int) {
return fileDescriptor_21dfaf6fd39fa3b7, []int{0}
}
func (m *AnnotationsTestMessage) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AnnotationsTestMessage.Unmarshal(m, b)
}
func (m *AnnotationsTestMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_AnnotationsTestMessage.Marshal(b, m, deterministic)
}
func (m *AnnotationsTestMessage) XXX_Merge(src proto.Message) {
xxx_messageInfo_AnnotationsTestMessage.Merge(m, src)
}
func (m *AnnotationsTestMessage) XXX_Size() int {
return xxx_messageInfo_AnnotationsTestMessage.Size(m)
}
func (m *AnnotationsTestMessage) XXX_DiscardUnknown() {
xxx_messageInfo_AnnotationsTestMessage.DiscardUnknown(m)
}
var xxx_messageInfo_AnnotationsTestMessage proto.InternalMessageInfo
func (m *AnnotationsTestMessage) GetAnnotationsTestField() string {
if m != nil && m.AnnotationsTestField != nil {
return *m.AnnotationsTestField
}
return ""
}
func init() {
proto.RegisterEnum("goproto.protoc.annotations.AnnotationsTestEnum", AnnotationsTestEnum_name, AnnotationsTestEnum_value)
proto.RegisterType((*AnnotationsTestMessage)(nil), "goproto.protoc.annotations.AnnotationsTestMessage")
}
func init() { proto.RegisterFile("annotations/annotations.proto", fileDescriptor_21dfaf6fd39fa3b7) }
var fileDescriptor_21dfaf6fd39fa3b7 = []byte{
// 194 bytes of a gzipped FileD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