Documentation ¶
Index ¶
- func DiffFileDescriptorSetsDeep(one *descriptor.FileDescriptorSet, two *descriptor.FileDescriptorSet, ...) (string, error)
- func DiffFileDescriptorSetsJSON(one *descriptor.FileDescriptorSet, two *descriptor.FileDescriptorSet, ...) (string, error)
- func GetDirPathToFilePathsForExt(ctx context.Context, baseDirPath string, ext string) (map[string][]string, error)
- func GetGithubArchive(httpClient *http.Client, outputDirPath string, owner string, repository string, ...) (string, error)
- func GetGoprotocFileDescriptorSet(protocLocation *ProtocLocation, includePath string, includeImports bool, ...) (*descriptor.FileDescriptorSet, error)
- func GetProtocFileDescriptorSet(ctx context.Context, protocLocation *ProtocLocation, includePath string, ...) (*descriptor.FileDescriptorSet, error)
- type ProtocLocation
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 ¶
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.