gno

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoGno = errors.New("no gno binary found")
)

Functions

This section is empty.

Types

type BinManager

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

BinManager is a wrapper for the gno binary and related tooling.

TODO: Should we install / update our own copy of gno?

func NewBinManager

func NewBinManager(gno, gnokey string, precompile, build bool) (*BinManager, error)

NewBinManager returns a new GnoManager.

If the user does not provide a path to the required binaries, we search the user's PATH for them.

`gno`: The path to the `gno` binary. `gnokey`: The path to the `gnokey` binary. `precompile`: Whether to precompile Gno files on save. `build`: Whether to build Gno files on save.

NOTE: Unlike `gnoBin`, `gnokey` is optional.

func (*BinManager) Build

func (m *BinManager) Build(gnoDir string) ([]byte, error)

Build a Gno package: gno build <dir>.

func (*BinManager) Format

func (m *BinManager) Format(gnoFile string) ([]byte, error)

Format a Gno file using std formatter.

TODO: support other tools?

func (*BinManager) GnoBin added in v0.3.0

func (m *BinManager) GnoBin() string

GnoBin returns the path to the `gno` binary.

This is either user-provided or found on the user's PATH.

func (*BinManager) Lint

func (m *BinManager) Lint(doc *store.Document) ([]BuildError, error)

Lint precompiles and builds a Gno package and returns any errors.

In practice, this means:

1. Precompile the file; 2. build the file; 3. parse the errors; and 4. recompute the offsets (.go -> .gno).

TODO: is this the best way?

func (*BinManager) Precompile

func (m *BinManager) Precompile(gnoDir string) ([]byte, error)

Precompile a Gno package: gno precompile <dir>.

func (*BinManager) RunTest

func (m *BinManager) RunTest(pkg, name string) ([]byte, error)

RunTest runs a Gno test:

gno test -timeout 30s -run ^TestName$ <pkg_path>

type BuildError

type BuildError struct {
	Path string
	Line int
	Span []int
	Msg  string
	Tool string
}

BuildError is an error returned by the `gno build` command.

Jump to

Keyboard shortcuts

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