Documentation
¶
Overview ¶
Package bazelmodules validates Bazel module registry uploads.
Index ¶
- func ArchiveStripPrefix(body io.ReadSeeker, size int64, name string) (string, error)
- func Integrity(hexDigest string) (string, error)
- func ParseModule(body []byte) (string, string, error)
- func Serves(t repo.PackageType) bool
- func ValidName(name string) bool
- func ValidVersion(version string) bool
- type File
- type Handler
- func (Handler) Admit(ctx context.Context, env format.Env, c repo.Config, w format.Write) (format.Write, error)
- func (Handler) GuardWrite(ctx context.Context, env format.Env, c repo.Config, w format.Write) error
- func (Handler) Inspect(ctx context.Context, env format.Env, _ repo.Config, w format.Write) (any, error)
- func (Handler) Reindex(ctx context.Context, env format.Env, c repo.Config) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArchiveStripPrefix ¶
ArchiveStripPrefix returns a single enclosing directory shared by every regular archive entry, the layout Bazel's archive repository must strip. A flat or mixed archive is already rooted and needs no prefix.
func ParseModule ¶
ParseModule reads literal module name/version attributes. Dynamic module declarations and duplicate attributes are rejected because identity would otherwise depend on executing arbitrary Starlark at publication time.
func Serves ¶
func Serves(t repo.PackageType) bool
func ValidName ¶
ValidName and ValidVersion are deliberately narrower than arbitrary item names. An ambiguous registry path cannot become an upload or a fetch target.
func ValidVersion ¶
Types ¶
type File ¶
type File struct{ Name, Version, Kind, ArchiveType string }
File identifies a native local publication file.
type Handler ¶
func (Handler) GuardWrite ¶
func (Handler) GuardWrite( ctx context.Context, env format.Env, c repo.Config, w format.Write, ) error
GuardWrite prevents two archives from claiming one module version. Bazel's source.json can name only one archive, so ambiguity must fail at upload.