goeval

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2021 License: MIT Imports: 7 Imported by: 0

README

goeval

Evaluate Golang Code by the Eval Function

Install

$ go get github.com/PaulXu-cn/goeval

Usage

package main

import (
    "fmt"
    "github.com/PaulXu-cn/goeval"
)

func main() {
    if re, err := goeval.Eval("", "fmt.Print(\"Hello World!\")", "fmt"); nil == err {
        fmt.Print(string(re))
    } else {
        fmt.Print(err.Error())
    }
}
Hello World!

It's simple! Try it.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Eval

func Eval(defineCode string, code string, imports ...string) (re []byte, err error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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