bufresolv

package module
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: MIT Imports: 17 Imported by: 2

README

Buf resolver for github.com/bufbuild/protocompile Go Reference build Coverage Code to Test Ratio Test Execution Time

Usage

r, _ := bufresolv.New(bufresolv.BufDir("path/to/bofroot"))
comp := protocompile.Compiler{
	Resolver: protocompile.WithStandardImports(r),
}
fds, _ := comp.Compile(ctx, r.Paths()...)

References

  • bufbuild/buf: The best way of working with Protocol Buffers.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BufConfigModuleV2 added in v0.7.0

type BufConfigModuleV2 struct {
	Path string `yaml:"path"`
}

type BufConfigV1V2 added in v0.7.0

type BufConfigV1V2 struct {
	Version string              `yaml:"version,omitempty"`
	Name    string              `yaml:"name,omitempty"`
	Modules []BufConfigModuleV2 `yaml:"modules,omitempty"`
	Deps    []string            `yaml:"deps,omitempty"`
}

type BufLockDepV1V2 added in v0.7.0

type BufLockDepV1V2 struct {
	NameV2     string `yaml:"name,omitempty"`
	Remote     string `yaml:"remote,omitempty"`
	Owner      string `yaml:"owner,omitempty"`
	Repository string `yaml:"repository,omitempty"`
	Branch     string `yaml:"branch,omitempty"`
	Commit     string `yaml:"commit,omitempty"`
}

type BufLockV1V2 added in v0.7.0

type BufLockV1V2 struct {
	Version string           `yaml:"version,omitempty"`
	Deps    []BufLockDepV1V2 `yaml:"deps,omitempty"`
}

type BufWorkV1

type BufWorkV1 struct {
	Version     string   `yaml:"version,omitempty"`
	Directories []string `yaml:"directories,omitempty"`
}

type Option

type Option func(*Resolver) error

func BufConfig

func BufConfig(configFile string) Option

BufConfig reads the config file and fetches the file descriptor set from buf.build. Supported versions are v1 and v2.

func BufDir

func BufDir(dir string) Option

BufWork reads the work file and fetches the file descriptor set from buf.build. Supported versions are v1 and v2.

func BufLock

func BufLock(lockFile string) Option

BufLock reads the lock file and fetches the file descriptor set from buf.build. Supported versions are v1 and v2.

func BufModule

func BufModule(modules ...string) Option

BufModule fetches the file descriptor set from buf.build.

type Resolver

type Resolver struct {
	// contains filtered or unexported fields
}

func New

func New(opts ...Option) (*Resolver, error)

New creates a new resolver.

func (*Resolver) FindFileByPath

func (r *Resolver) FindFileByPath(path string) (protocompile.SearchResult, error)

func (*Resolver) Paths

func (r *Resolver) Paths() []string

Paths returns the paths of the file descriptor sets and sources.

Jump to

Keyboard shortcuts

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