Documentation ¶
Overview ¶
Package locations provides functions to get the location of a particular part of a descriptor, allowing Problems to be attached to just a descriptor's name, type, etc.. This allows for better auto-replacement functionality in code review tools.
All functions in this package accept a descriptor and return a protobuf SourceCodeInfo_Location object, which can be passed directly to the Location property on Problem.
Index ¶
- func DescriptorName(d desc.Descriptor) *dpb.SourceCodeInfo_Location
- func FieldLabel(f *desc.FieldDescriptor) *dpb.SourceCodeInfo_Location
- func FieldResourceReference(f *desc.FieldDescriptor) *dpb.SourceCodeInfo_Location
- func FieldType(f *desc.FieldDescriptor) *dpb.SourceCodeInfo_Location
- func FileCsharpNamespace(f *desc.FileDescriptor) *dpb.SourceCodeInfo_Location
- func FileJavaPackage(f *desc.FileDescriptor) *dpb.SourceCodeInfo_Location
- func FilePackage(f *desc.FileDescriptor) *dpb.SourceCodeInfo_Location
- func FilePhpNamespace(f *desc.FileDescriptor) *dpb.SourceCodeInfo_Location
- func FileRubyPackage(f *desc.FileDescriptor) *dpb.SourceCodeInfo_Location
- func FileSyntax(f *desc.FileDescriptor) *dpb.SourceCodeInfo_Location
- func MessageResource(m *desc.MessageDescriptor) *dpb.SourceCodeInfo_Location
- func MethodHTTPRule(m *desc.MethodDescriptor) *dpb.SourceCodeInfo_Location
- func MethodOperationInfo(m *desc.MethodDescriptor) *dpb.SourceCodeInfo_Location
- func MethodRequestType(m *desc.MethodDescriptor) *dpb.SourceCodeInfo_Location
- func MethodResponseType(m *desc.MethodDescriptor) *dpb.SourceCodeInfo_Location
- func MethodSignature(m *desc.MethodDescriptor, index int) *dpb.SourceCodeInfo_Location
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DescriptorName ¶
func DescriptorName(d desc.Descriptor) *dpb.SourceCodeInfo_Location
DescriptorName returns the precise location for a descriptor's name.
This works for any descriptor, regardless of type (message, field, etc.).
func FieldLabel ¶ added in v1.6.0
func FieldLabel(f *desc.FieldDescriptor) *dpb.SourceCodeInfo_Location
FieldLabel returns the precise location for a field's label.
func FieldResourceReference ¶
func FieldResourceReference(f *desc.FieldDescriptor) *dpb.SourceCodeInfo_Location
FieldResourceReference returns the precise location for a field's resource reference annotation.
func FieldType ¶
func FieldType(f *desc.FieldDescriptor) *dpb.SourceCodeInfo_Location
FieldType returns the precise location for a field's type.
func FileCsharpNamespace ¶
func FileCsharpNamespace(f *desc.FileDescriptor) *dpb.SourceCodeInfo_Location
FileCsharpNamespace returns the location of the csharp_namespace file option in a file descriptor.
If the location can not be found (for example, because there is no csharp_namespace option), it returns nil.
func FileJavaPackage ¶
func FileJavaPackage(f *desc.FileDescriptor) *dpb.SourceCodeInfo_Location
FileJavaPackage returns the location of the java_package file option in a file descriptor.
If the location can not be found (for example, because there is no java_package option), it returns nil.
func FilePackage ¶
func FilePackage(f *desc.FileDescriptor) *dpb.SourceCodeInfo_Location
FilePackage returns the location of the package definition in a file descriptor.
If the location can not be found (for example, because there is no package statement), it returns nil.
func FilePhpNamespace ¶
func FilePhpNamespace(f *desc.FileDescriptor) *dpb.SourceCodeInfo_Location
FilePhpNamespace returns the location of the php_namespace file option in a file descriptor.
If the location can not be found (for example, because there is no php_namespace option), it returns nil.
func FileRubyPackage ¶
func FileRubyPackage(f *desc.FileDescriptor) *dpb.SourceCodeInfo_Location
FileRubyPackage returns the location of the ruby_package file option in a file descriptor.
If the location can not be found (for example, because there is no ruby_package option), it returns nil.
func FileSyntax ¶
func FileSyntax(f *desc.FileDescriptor) *dpb.SourceCodeInfo_Location
FileSyntax returns the location of the syntax definition in a file descriptor.
If the location can not be found (for example, because there is no syntax statement), it returns nil.
func MessageResource ¶
func MessageResource(m *desc.MessageDescriptor) *dpb.SourceCodeInfo_Location
MessageResource returns the precise location of the `google.api.resource` annotation.
func MethodHTTPRule ¶
func MethodHTTPRule(m *desc.MethodDescriptor) *dpb.SourceCodeInfo_Location
MethodHTTPRule returns the precise location of the method's `google.api.http` rule, if any.
func MethodOperationInfo ¶
func MethodOperationInfo(m *desc.MethodDescriptor) *dpb.SourceCodeInfo_Location
MethodOperationInfo returns the precise location of the method's `google.longrunning.operation_info` annotation, if any.
func MethodRequestType ¶
func MethodRequestType(m *desc.MethodDescriptor) *dpb.SourceCodeInfo_Location
MethodRequestType returns the precise location of the method's input type.
func MethodResponseType ¶
func MethodResponseType(m *desc.MethodDescriptor) *dpb.SourceCodeInfo_Location
MethodResponseType returns the precise location of the method's output type.
func MethodSignature ¶
func MethodSignature(m *desc.MethodDescriptor, index int) *dpb.SourceCodeInfo_Location
MethodSignature returns the precise location of the method's `google.api.method_signature` annotation, if any.
Types ¶
This section is empty.