embedded

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package embedded provides proto files bundled into the Buffalo binary.

When Buffalo is installed via `go install`, the proto files for buffalo.validate are embedded into the binary and can be extracted to the user's project workspace at any time.

This solves the problem of proto files not being available after `go install`, since Go only installs the compiled binary.

Index

Constants

This section is empty.

Variables

View Source
var ProtoFS embed.FS

ProtoFS contains all embedded proto files from the proto/ directory tree. The files are available at runtime and can be extracted to disk via ExtractValidateProto().

Functions

func ExtractAllProtos

func ExtractAllProtos(workspaceDir string) (protoPath string, err error)

ExtractAllProtos extracts every embedded proto file into workspaceDir and returns the root proto_path that should be passed to protoc.

Existing files are overwritten to ensure the version matches the binary.

func ExtractValidateProto

func ExtractValidateProto(workspaceDir string) (protoPath string, err error)

ExtractValidateProto extracts the embedded buffalo/validate/validate.proto into the given workspace directory.

The file is placed at:

<workspaceDir>/proto/buffalo/validate/validate.proto

It returns the absolute path to the directory that should be added to protoc's --proto_path (i.e. <workspaceDir>/proto).

func ListEmbeddedProtos

func ListEmbeddedProtos() ([]string, error)

ListEmbeddedProtos returns a list of all embedded proto file paths.

func ValidateProtoImportPath

func ValidateProtoImportPath(workspaceDir string) (string, error)

ValidateProtoImportPath returns the proto_path that should be added to protoc / Buffalo import paths so that `import "buffalo/validate/validate.proto";` resolves correctly. If the files haven't been extracted yet, it extracts them.

workspaceDir is typically ".buffalo".

Types

This section is empty.

Jump to

Keyboard shortcuts

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