starlib

package
Version: v0.0.0-...-9fd277f Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: BSD-3-Clause Imports: 39 Imported by: 0

README

starlib

Starlib is a set of starlark modules that extend the feature set of the language.

Cloud modules are based on gocloud.dev.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FprintErr

func FprintErr(w io.Writer, err error)

func FprintStatus

func FprintStatus(w io.Writer, status *spb.Status)

func NewGlobals

func NewGlobals() starlark.StringDict

func NewModule

func NewModule() *starlarkstruct.Module

func RunBenches

func RunBenches(b *testing.B, pattern string, globals starlark.StringDict)

RunBenches calls starlarkassert.RunBenches with options for larking libraries. To use add it to a Benchmark function:

func BenchmarkStarlark(b *testing.B) {
	starlib.RunBenches(b, "testdata/*.star", nil)
}

func RunTests

func RunTests(t *testing.T, pattern string, globals starlark.StringDict)

RunTests calls starlarkassert.RunTests with options for larking libraries. To use add it to a Test function:

func TestStarlark(t *testing.T) {
	starlib.RunTests(b, "testdata/*.star", nil)
}

Types

type Args

type Args interface {
	starlark.Callable
	ArgNames() []string
}

An Args is a starlark Callable with arguments.

type Completer

type Completer struct {
	starlark.StringDict
}

Completer is an experimental autocompletion for starlark lines. TODO: drop and switch to a proper language server.

func (Completer) Complete

func (c Completer) Complete(line string) (values []string)

Complete tries to resolve a starlark line variable to global named values. TODO: use a proper parser to resolve values.

type Loader

type Loader struct {
	starext.Blobs
	// contains filtered or unexported fields
}

Loader is a cloud.Blob backed loader. It uses thread.Name to figure out the current bucket and module. TODO: document how this works.

func NewLoader

func NewLoader(globals starlark.StringDict) *Loader

func (*Loader) Load

func (l *Loader) Load(thread *starlark.Thread, module string) (starlark.StringDict, error)

Load checks the standard library before loading from buckets.

func (*Loader) LoadSource

func (l *Loader) LoadSource(ctx context.Context, bktURL string, key string) ([]byte, error)

LoadSource fetches the source file in bytes from a bucket.

func (*Loader) StdLoad

func (l *Loader) StdLoad(thread *starlark.Thread, module string) (starlark.StringDict, error)

StdLoad loads files from the standard library.

Directories

Path Synopsis
archive
starlarktar
https://pkg.go.dev/archive/tar
https://pkg.go.dev/archive/tar
starlarkzip
https://pkg.go.dev/archive/zip
https://pkg.go.dev/archive/zip
encoding
starlarkproto
Package starlarkproto provides support for protocol buffers.
Package starlarkproto provides support for protocol buffers.
net
starlarkhttp
Package http provides HTTP client implementations.
Package http provides HTTP client implementations.
Package blob provides access to blob objects within a storage location.
Package blob provides access to blob objects within a storage location.
Package starlarkdocstore supports noSQL document databases.
Package starlarkdocstore supports noSQL document databases.
Package errors implements functions to manipulate errors.
Package errors implements functions to manipulate errors.
Package starlarkio implements readers and writers.
Package starlarkio implements readers and writers.
Package starlarkpubsub provides methods for publishing and recieving messages.
Package starlarkpubsub provides methods for publishing and recieving messages.
Laze is a task scheduler inspired by Bazel and the Go build tool.
Laze is a task scheduler inspired by Bazel and the Go build tool.
Package runtimevar adds configuration variables at runtime.
Package runtimevar adds configuration variables at runtime.
Package sql provides an interface to conntect to SQL databases.
Package sql provides an interface to conntect to SQL databases.
Package starlarkstruct defines the Starlark types 'struct' and 'module', both optional language extensions.
Package starlarkstruct defines the Starlark types 'struct' and 'module', both optional language extensions.

Jump to

Keyboard shortcuts

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