goplay

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSnippetNotFound = errors.New("snippet not found")
View Source
var ErrSnippetTooLarge = fmt.Errorf("code snippet too large (max %d bytes)", maxSnippetSize)

Functions

func IsCompileError added in v1.1.0

func IsCompileError(err error) bool

func Share added in v1.1.0

func Share(ctx context.Context, src io.Reader) (string, error)

func ValidateContentLength added in v1.1.0

func ValidateContentLength(itemLen int) error

Types

type CompileEvent

type CompileEvent struct {
	Message string
	Kind    string
	Delay   time.Duration
}

CompileEvent represents individual event record in CompileResponse

type CompileFailedError added in v1.1.0

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

func (CompileFailedError) Error added in v1.1.0

func (c CompileFailedError) Error() string

type CompileResponse

type CompileResponse struct {
	Body   *string
	Events []*CompileEvent
	Errors string
}

CompileResponse is the response returned from upstream play.golang.org/compile request

func Compile

func Compile(ctx context.Context, src []byte) (*CompileResponse, error)

func (CompileResponse) GetBody

func (r CompileResponse) GetBody() string

func (*CompileResponse) HasError

func (cr *CompileResponse) HasError() error

type FmtResponse

type FmtResponse struct {
	Body  string
	Error string
}

FmtResponse is the response returned from upstream play.golang.org/fmt request

func GoImports

func GoImports(ctx context.Context, src []byte) (*FmtResponse, error)

func (*FmtResponse) HasError

func (r *FmtResponse) HasError() error

type Snippet added in v1.1.0

type Snippet struct {
	FileName string
	Contents string
}

Snippet represents shared snippet

func GetSnippet added in v1.1.0

func GetSnippet(ctx context.Context, snippetID string) (*Snippet, error)

Jump to

Keyboard shortcuts

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