goscript

package module
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 16 Imported by: 0

README

Go-script. WASM Capable Go Scripting.

Go-script provides a self contained go scripting environment that can be compiled to WASM.

This enables client side browser based execution of go code. This can be used to create a client side playground for your library.

WARNING: This code is extremely hacky and is currently only fit to be used by the go-optic project

Documentation

Index

Constants

This section is empty.

Variables

Functions

func Coerce

func Coerce[A any](c *runScope, source any) A

func ReflectCoerce

func ReflectCoerce(c *runScope, sourceVal reflect.Value, targetType reflect.Type) (reflect.Value, bool)

func RegisterEraser

func RegisterEraser(t TypeEraser)

func RegisterPackage

func RegisterPackage(p *Package)

func RegisterTransformer

func RegisterTransformer(t Transformer)

func Run

func Run(ctx context.Context, script string) error

func SafeCoerce

func SafeCoerce[A any](c *runScope, source any) (A, bool)

Types

type GenericFunction

type GenericFunction func(typeParams []reflect.Type) reflect.Value

type Number

type Number interface {
	constraints.Integer | constraints.Float
}

type Package

type Package struct {
	Name          string
	Exported      map[string]reflect.Value
	ExportedTypes map[string]reflect.Type
}

type Transformer

type Transformer func(reflect.Value, reflect.Type) reflect.Value

type TypeEraser

type TypeEraser func(reflect.Value) reflect.Value

Directories

Path Synopsis
cmd
playground command
github.com

Jump to

Keyboard shortcuts

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