bufresolv

package module
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: May 5, 2024 License: MIT Imports: 17 Imported by: 2

README

Buf resolver for github.com/bufbuild/protocompile

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 BufConfigV1

type BufConfigV1 struct {
	Version string   `yaml:"version,omitempty"`
	Name    string   `yaml:"name,omitempty"`
	Deps    []string `yaml:"deps,omitempty"`
}

type BufLockDepV1 added in v0.6.2

type BufLockDepV1 struct {
	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 BufLockV1

type BufLockV1 struct {
	Version string         `yaml:"version,omitempty"`
	Deps    []BufLockDepV1 `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.

func BufDir

func BufDir(dir string) Option

BufWork reads the work file and fetches the file descriptor set from buf.build.

func BufLock

func BufLock(lockFile string) Option

BufLock reads the lock file and fetches the file descriptor set from buf.build.

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