internal

package
v0.0.0-...-05d2646 Latest Latest
Warning

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

Go to latest
Published: May 24, 2019 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiffFileDescriptorSetsDeep

func DiffFileDescriptorSetsDeep(one *descriptor.FileDescriptorSet, two *descriptor.FileDescriptorSet, name string) (string, error)

DiffFileDescriptorSetsDeep diffs two FileDescriptorSets using github.com/go-test/deep.

func DiffFileDescriptorSetsJSON

func DiffFileDescriptorSetsJSON(one *descriptor.FileDescriptorSet, two *descriptor.FileDescriptorSet, name string) (string, error)

DiffFileDescriptorSetsJSON diffs two FileDescriptorSets by comparing their JSON representation.

func GetDirPathToFilePathsForExt

func GetDirPathToFilePathsForExt(ctx context.Context, baseDirPath string, ext string) (map[string][]string, error)

GetDirPathToFilePathsForExt gets a map from directory path to file paths for all files with the given extension.

The provided context allows a timeout to be passed. File paths in the returned map will be complete, that is {"a/b" => ["a/b/c.proto", "a/b/d.proto"]}.

func GetGithubArchive

func GetGithubArchive(
	httpClient *http.Client,
	outputDirPath string,
	owner string,
	repository string,
	ref string,
) (string, error)

GetGithubArchive downloads a Github archive and extracts it to a subdirectory in outputDirPath.

If the expected directory already exists, this does nothing.

Returns the path to the subdirectory.

func GetGoprotocFileDescriptorSet

func GetGoprotocFileDescriptorSet(
	protocLocation *ProtocLocation,
	includePath string,
	includeImports bool,
	includeSourceInfo bool,
	filePaths ...string,
) (*descriptor.FileDescriptorSet, error)

GetGoprotocFileDescriptorSet gets the FileDescriptorSet for the given file paths using goprotoc.

The protocLocation can be nil if you do not want the WKTs to be included manually.

func GetProtocFileDescriptorSet

func GetProtocFileDescriptorSet(
	ctx context.Context,
	protocLocation *ProtocLocation,
	includePath string,
	includeImports bool,
	includeSourceInfo bool,
	filePaths ...string,
) (*descriptor.FileDescriptorSet, error)

GetProtocFileDescriptorSet gets the FileDescriptorSet for the given file paths using protoc.

The provided context allows a timeout to be passed.

Types

type ProtocLocation

type ProtocLocation struct {
	BinPath     string
	IncludePath string
}

ProtocLocation is the location of a protoc binary and the protoc include directory.

func GetProtocLocation

func GetProtocLocation() (*ProtocLocation, error)

GetProtocLocation gets the current ProtocLocation according to the current PATH.

If protoc is installed in a common location such as /usr/local/bin, it will include the WKTs automatically, but if it is not, it will not. This should probably be updated in protocolbuffers/protobuf. Note that goprotoc includes them wherever they are due to the design of desc/protoparse.

Jump to

Keyboard shortcuts

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