Version: v1.6.2 Latest Latest

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

Go to latest
Published: Aug 20, 2020 License: MIT Imports: 19 Imported by: 0




This section is empty.


This section is empty.


func NewCORSDisablerWrapper

func NewCORSDisablerWrapper(parent http.Handler) http.Handler

NewCORSDisablerWrapper returns new CORS middleware

func SpaFileServer added in v1.1.0

func SpaFileServer(root http.Dir) http.Handler

SpaFileServer returns SPA handler

func ValidateContentLength added in v1.4.1

func ValidateContentLength(r *http.Request) error

ValidateContentLength validates Go code snippet size

func WrapHandler added in v1.4.1

func WrapHandler(h HandlerFunc, guards ...GuardFn) http.HandlerFunc

WrapHandler wraps handler

func WriteJSON

func WriteJSON(w http.ResponseWriter, i interface{})

WriteJSON encodes object as JSON and writes it to stdout


type BuildResponse added in v1.3.0

type BuildResponse struct {
	// Formatted contains goimport'ed code
	Formatted string `json:"formatted,omitempty"`

	// FileName is file name
	FileName string `json:"fileName,omitempty"`

BuildResponse is code complile response

type ErrorResponse

type ErrorResponse struct {

	// Error is error message
	Error string `json:"error"`
	// contains filtered or unexported fields

ErrorResponse is error response

func NewErrorResponse

func NewErrorResponse(err error) *ErrorResponse

NewErrorResponse is ErrorResponse constructor

func (*ErrorResponse) Write

Write writes error to response

type GuardFn added in v1.4.1

type GuardFn func(r *http.Request) error

GuardFn is guard middleware handler

type HTTPError added in v1.4.1

type HTTPError struct {
	// contains filtered or unexported fields

HTTPError is HTTP response error

func Errorf

func Errorf(code int, format string, args ...interface{}) *HTTPError

Errorf returns new formatted error

func NewHTTPError added in v1.4.1

func NewHTTPError(code int, err error) *HTTPError

NewHTTPError constructs a new error

func (*HTTPError) Error added in v1.4.1

func (err *HTTPError) Error() string

Error implements error

func (*HTTPError) Unwrap added in v1.4.1

func (err *HTTPError) Unwrap() error

Unwrap implements error

func (*HTTPError) WriteResponse added in v1.4.1

func (err *HTTPError) WriteResponse(rw http.ResponseWriter)

WriteResponse writes error to response

type HandlerFunc added in v1.4.1

type HandlerFunc func(http.ResponseWriter, *http.Request) error

HandlerFunc is langserver request handler

type RunResponse added in v1.3.0

type RunResponse struct {
	// Formatted contains goimport'ed code
	Formatted string `json:"formatted,omitempty"`

	// Events is list of code execution outputs
	Events []*goplay.CompileEvent `json:"events,omitempty"`

RunResponse is code run response

type Service

type Service struct {
	// contains filtered or unexported fields

Service is language server service

func New

func New(version string, playground *goplay.Client, packages []*analyzer.Package, builder compiler.BuildService) *Service

New is Service constructor

func (*Service) HandleArtifactRequest added in v1.3.0

func (s *Service) HandleArtifactRequest(w http.ResponseWriter, r *http.Request) error

HandleArtifactRequest handles WASM build artifact request

func (*Service) HandleCompile added in v1.3.0

func (s *Service) HandleCompile(w http.ResponseWriter, r *http.Request) error

HandleCompile handles WASM build request

func (*Service) HandleFormatCode added in v1.3.0

func (s *Service) HandleFormatCode(w http.ResponseWriter, r *http.Request) error

HandleFormatCode handles goimports action

func (*Service) HandleGetSnippet added in v1.3.0

func (s *Service) HandleGetSnippet(w http.ResponseWriter, r *http.Request) error

HandleGetSnippet handles snippet load

func (*Service) HandleGetSuggestion added in v1.3.0

func (s *Service) HandleGetSuggestion(w http.ResponseWriter, r *http.Request) error

HandleGetSuggestion handles code suggestion

func (*Service) HandleGetVersion added in v1.5.0

func (s *Service) HandleGetVersion(w http.ResponseWriter, r *http.Request) error

HandleGetVersion handles /api/version

func (*Service) HandleRunCode added in v1.3.0

func (s *Service) HandleRunCode(w http.ResponseWriter, r *http.Request) error

HandleRunCode handles code run

func (*Service) HandleShare added in v1.3.0

func (s *Service) HandleShare(w http.ResponseWriter, r *http.Request) error

HandleShare handles snippet share

func (*Service) Mount

func (s *Service) Mount(r *mux.Router)

Mount mounts service on route

type ShareResponse added in v1.1.0

type ShareResponse struct {
	// SnippetID is definitely not a snippet id (sarcasm)
	SnippetID string `json:"snippetID"`

ShareResponse is snippet share response

type SnippetResponse added in v1.1.0

type SnippetResponse struct {
	// FileName is snippet file name
	FileName string `json:"fileName"`

	// Code is snippet source
	Code string `json:"code"`

SnippetResponse is snippet response

type SuggestionRequest

type SuggestionRequest struct {
	PackageName string `json:"packageName"`
	Value       string `json:"value"`

SuggestionRequest is code completion suggestion request

func (SuggestionRequest) Trim

Trim trims request payload

type SuggestionsResponse

type SuggestionsResponse struct {
	// Suggestions is list of suggestions for monaco
	Suggestions []*analyzer.CompletionItem `json:"suggestions"`

SuggestionsResponse is code completion response

func (SuggestionsResponse) Write

Write writes data to response

type VersionResponse added in v1.5.0

type VersionResponse struct {
	// Version is server version
	Version string `json:"version"`

VersionResponse is version response

func (VersionResponse) Write added in v1.5.0

func (r VersionResponse) Write(w http.ResponseWriter)

Write writes data to response

Jump to

Keyboard shortcuts

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