mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-14 12:23:43 +00:00
23 lines
267 B
Go
23 lines
267 B
Go
//go:build !moejs
|
|
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/dop251/goja"
|
|
"os"
|
|
)
|
|
|
|
func main() {
|
|
source := "1+1"
|
|
if len(os.Args) > 1 {
|
|
source = os.Args[1]
|
|
}
|
|
rt := goja.New()
|
|
v, e := rt.RunString(source)
|
|
if e != nil {
|
|
panic(e)
|
|
}
|
|
fmt.Println(v.Export())
|
|
}
|