goeval

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2022 License: MIT Imports: 9 Imported by: 0

README

goeval

Evaluate Golang Code by the Eval Function

Install

$ go get github.com/tekintian/goeval

Usage

package main

import (
    "fmt"
    "github.com/tekintian/goeval"
)

func main() {
    if re, err := goeval.Eval("", "fmt.Print(\"Hello World!\")", "fmt"); nil == err {
        fmt.Println(string(re))
    } else {
        fmt.Println(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