locations

package
v1.35.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 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 added in v1.6.0

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 FileCCEnableArenas added in v1.29.4

func FileCCEnableArenas(f *desc.FileDescriptor) *dpb.SourceCodeInfo_Location

FileCCEnableArenas returns the location of the `cc_enable_arenas` option.

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 FileImport added in v1.29.4

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

FileImport returns the location of the import on the given `index`, or `nil` if no import with such `index` is found.

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 added in v1.18.0

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 added in v1.29.2

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