locations

package
v1.29.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

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

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

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

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

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 FileResourceDefinition

func FileResourceDefinition(f *desc.FileDescriptor, index int) *dpb.SourceCodeInfo_Location

FileResourceDefinition returns the precise location of the `google.api.resource_definition` annotation.

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

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

MessageResource returns the precise location of the `google.api.resource` annotation.

func MethodHTTPRule

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 MethodOption

func MethodOption(m *desc.MethodDescriptor, fieldNumber int) *dpb.SourceCodeInfo_Location

MethodOption returns the precise location of the method's option with the given field number, 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL