A Go API for the V8 javascript engine.

V8 Bindings for Go Build Status Go Report Card GoDoc

The v8 bindings allow a user to execute javascript from within a go executable.

The bindings are tested to work with several recent v8 builds matching the Chrome builds 54 - 60 (see the .travis.yml file for specific versions). For example, Chrome 59 (dev branch) uses v8 5.9.211.4 when this was written.

Note that v8 releases match the Chrome release timeline: Chrome 48 corresponds to v8 4.8.*, Chrome 49 matches v8 4.9.*. You can see the table of current chrome and the associated v8 releases at:

http://omahaproxy.appspot.com/

Using a pre-compiled v8

v8 is very slow to compile, it's a large project. If you want to go that route, there are building instructions below.

Fortunately, there's a project that pre-builds v8 for various platforms. It's packaged as a ruby gem called libv8.

# Find the appropriate gem version for your OS,
# visit: https://rubygems.org/gems/libv8/versions

# Download the gem
# MacOS Sierra is darwin-16, for v8 6.3.292.48.1 it looks like:
curl https://rubygems.org/downloads/libv8-6.3.292.48.1-x86_64-darwin-16.gem > libv8.gem

# Extract the gem (it's a tarball)
tar -xf libv8.gem

# Extract the `data.tar.gz` within
cd libv8-6.3.292.48.1-x86_64-darwin-16
tar -xzf data.tar.gz

# Symlink the compiled libraries and includes
ln -s $(pwd)/data/vendor/v8/include $GOPATH/src/github.com/augustoroman/v8/include
ln -s $(pwd)/data/vendor/v8/out/x64.release $GOPATH/src/github.com/augustoroman/v8/libv8

# Run the tests to make sure everything works
cd $GOPATH/src/github.com/augustoroman/v8
go test

Using docker (linux only)

For linux builds, you can use pre-built libraries or build your own.

Pre-built versions

To use a pre-built library, select the desired v8 version from https://hub.docker.com/r/augustoroman/v8-lib/tags/ and then run:

# Select the v8 version to use:
export V8_VERSION=6.7.77
docker pull augustoroman/v8-lib:$V8_VERSION           # Download the image, updating if necessary.
docker rm v8 ||:                                      # Cleanup from before if necessary.
docker run --name v8 augustoroman/v8-lib:$V8_VERSION  # Run the image to provide access to the files.
docker cp v8:/v8/include include/                     # Copy the include files.
docker cp v8:/v8/lib libv8/                           # Copy the library fiels.

Build your own via docker

This takes a lot longer, but is still easy:

export V8_VERSION=6.7.77
docker build --build-arg V8_VERSION=$V8_VERSION --tag augustoroman/v8-lib:$V8_VERSION docker-v8-lib/

and then extract the files as above:

docker rm v8 ||:                                      # Cleanup from before if necessary.
docker run --name v8 augustoroman/v8-lib:$V8_VERSION  # Run the image to provide access to the files.
docker cp v8:/v8/include include/                     # Copy the include files.
docker cp v8:/v8/lib libv8/                           # Copy the library fiels.

Building v8

Prep

You need to build v8 statically and place it in a location cgo knows about. This requires special tooling and a build directory. Using the official instructions as a guide, the general steps of this process are:

  1. go get the binding library (this library)
  2. Create a v8 build directory
  3. Install depot tools
  4. Configure environment
  5. Download v8
  6. Build v8
  7. Copy or symlink files to the go library path
  8. Build the bindings
go get github.com/augustoroman/v8
export V8_GO=$GOPATH/src/github.com/augustoroman/v8
export V8_BUILD=$V8_GO/v8/build #or wherever you like
mkdir -p $V8_BUILD
cd $V8_BUILD
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH=$PATH:$V8_BUILD/depot_tools
fetch v8 #pull down v8 (this will take some time)
cd v8
git checkout 6.7.77
gclient sync

Linux

./build/install-build-deps.sh #only needed once
gn gen out.gn/golib --args="strip_debug_info=true v8_use_external_startup_data=false v8_enable_i18n_support=false v8_enable_gdbjit=false v8_static_library=true symbol_level=0 v8_experimental_extra_library_files=[] v8_extra_library_files=[]"
ninja -C out.gn/golib
# go get some coffee

OSX

gn gen out.gn/golib --args="is_official_build=true strip_debug_info=true v8_use_external_startup_data=false v8_enable_i18n_support=false v8_enable_gdbjit=false v8_static_library=true symbol_level=0 v8_experimental_extra_library_files=[] v8_extra_library_files=[]"
ninja -C out.gn/golib
# go get some coffee

Symlinking

Now you can create symlinks so that cgo can associate the v8 binaries with the go library.

cd $V8_GO
./symlink.sh $V8_BUILD/v8

Verifying

You should be done! Try running go test

Reference

Also relevant is the v8 API release changes doc:

https://docs.google.com/document/d/1g8JFi8T_oAE_7uAri7Njtig7fKaPDfotU6huOa1alds/edit

Credits

This work is based off of several existing libraries:

Comments
  • Add Value.GetPromiseState and Value.GetPromiseResult

    Add Value.GetPromiseState and Value.GetPromiseResult

    Promises are pretty useful for modern JS.

    They're probably similar to other kinds of values, except they have special properties.

    https://v8docs.nodesource.com/node-9.3/d3/d8f/classv8_1_1_promise.html

    It's possible to get the State of a Promise and to get at its Result (once it's resolved.)

    To let v8 know it should run the promises, we'd also need to call RunMicroTasks on the Isolate.

  • linux build failing

    linux build failing

    I am trying to build in a linux docker container and, try as I might, I either get v8_libbase and v8_libplatform only or everything but v8_libbase and v8_libbplatform. It's driving me nuts. Any ideas?

  • Undefined symbol v8::ArrayBuffer::Allocator

    Undefined symbol v8::ArrayBuffer::Allocator

    $ go test
    # github.com/augustoroman/v8
    Undefined symbols for architecture x86_64:
      "typeinfo for v8::ArrayBuffer::Allocator", referenced from:
          typeinfo for ArrayBufferAllocator in _x004.o
    ld: symbol(s) not found for architecture x86_64
    clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)
    FAIL	github.com/augustoroman/v8 [build failed]
    

    If I check the symbols with nm -g, I found:

    0000000000035500 T __ZN2v811ArrayBuffer9AllocatorD0Ev
    00000000000354f0 T __ZN2v811ArrayBuffer9AllocatorD1Ev
    

    I've been using pre-compiled versions of v8: https://rubygems.org/gems/libv8

    I guess it's not finding the symbol because it's mangled? I thought this was handled somehow via the bridge.

    Is the pre-compiled v8 at fault here? I dreaded compiling it myself because of how time consuming it is.

  • Update README.md for v8 download and installation

    Update README.md for v8 download and installation

    The docs were way out of date as discussed in #8. Most notably, make is no longer the recommended method for building, v8_static_library needs to be specified directly, and sw_vers -productVersion on OSX is actually too specific and will generate annoying warnings like the following:

    ld: warning: object file (foo.a(bar.c.o)) was built for newer OSX version (10.13.3) than being linked (10.13)

    I also modified the build instructions to just build v8 directly from the library path, and I removed the bit about fat binaries under linux as I wasn't sure if it applied any longer. Please feel free to verify.

  • Fixes typeinfo error

    Fixes typeinfo error

    Also should build on travis, can't really test with my repo because of hard-coded "augustoroman", and the very nature of golang package imports :)

    We should see if this works when travis builds this PR.

  • Support other kinds of buffers

    Support other kinds of buffers

    ECMAScript prescribes a plethora of buffer types (TypedArray), including ArrayBuffer (already supported), DataView and other wrappers.

    There's also SharedArrayBuffer which allows to share memory. That one might be trickier.

    Would it be possible to implement Uint8Array and the likes? I bet the API is not all that different, they're mostly "views" on top of ArrayBuffer. I guess it could be transformed into the proper type like []int32 for Int32Array. Not sure if that's desirable though.

  • libplatform/libplatform.h not found

    libplatform/libplatform.h not found

    After running the install steps in the readme.md it fails libplatform/libplatform.h not found and does the same for go test.

    $ go test
    # github.com/augustoroman/v8
    v8_c_bridge.cc:3:10: fatal error: libplatform/libplatform.h: No such file or directory
     #include "libplatform/libplatform.h"
    
  • Segmentation faults

    Segmentation faults

    I'm segmentation faults on in various situations. I'm still trying to create the smallest test case that exhibits the problem, but so far, I've been unsuccessful.

    I'm eval'ing the following code:

     marvin = {
        _triggers: [],
        _inputs: [],
        _inputValues: {
            
        },
        _inputsSeen: {},
        isSetup: true
    };
    
    marvin._runAction = (provider, groupp, name, input) => {
            if(marvin.isSetup){
                throw new Error(`Can't call an action: ${provider}.${group}.${name}, during setup.`);
            }
            return _runAction(provider, group, name, input);
    };
    
    marvin.input = (name, description) => {
        if(!marvin._inputsSeen[name]){
            marvin._inputs.push({name, description});
            marvin._inputsSeen[name] = true;
        }
        return marvin._inputValues[name];
    };
    
    
    http = {};
    http.request = {};
    http.request.send = (input) => marvin._runAction("http", "request", "send", input);
    
    time = {};
    time.cron = {};
     time.cron.schedule = (input, callback) => marvin._triggers.push({
         provider: "time",
         group: "cron",
         action: "schedule",
         input: input,
         callback: callback
     });
    time.cron.nextScheduledTime = (input) => marvin._runAction("time", "cron", "nextScheduledTime", input);
            
    time.cron.schedule({expression: "0-59/10 * * * * * *"}, (result) => {
        return doesNotExist;
    });
    marvin.isSetup=false;
    marvin._triggers[0].callback(__triggeredEvent) 
    

    I've cleaned up some of the whitespace in this code a bit when posting it here, because it's generated using a Go template. I know it's quite long, but I haven't managed to write a shorter piece of js that triggers the same behaviour.

    The context is created like this:

    func (c *Chore) CreateContext() *v8.Context {
    	is := v8.NewIsolate()
    	jsCtx := is.NewContext()
    
    	runAction := jsCtx.Bind("_runAction", func(args v8.CallbackArgs) (*v8.Value, error) {
    		provider := args.Arg(0).String()
    		group := args.Arg(1).String()
    		action := args.Arg(2).String()
    
    		a, err := actions.Registry.GetAction(provider, group, action)
    		if err != nil {
    			return nil, err
    		}
    
    		inBytes, err := args.Arg(3).MarshalJSON()
    		if err != nil {
    			return nil, err
    		}
    
    		in := reflect.New(reflect.TypeOf(a.Info().InputType)).Interface()
    		err = json.Unmarshal(inBytes, in)
    		if err != nil {
    			return nil, err
    		}
    
    		out, err := a.Run(in, context.Background())
    		if err != nil {
    			return nil, err
    		}
    
    		return jsCtx.Create(out)
    	})
    	jsCtx.Global().Set("_runAction", runAction)
    
    	cons := v8console.Config{Stdout: os.Stdout, Stderr: os.Stderr}
    	cons.Inject(jsCtx)
    
    	return jsCtx
    }
    
    // And in the function that executes the code:
    eventValue, err := jsCtx.Create(value)
    if err != nil {
    	// ...
    }
    
    err = jsCtx.Global().Set("__triggeredEvent", eventValue)
    if err != nil {
    	//...
    }
    
    go func() {
    		code := c.getJS()
    		fmt.Println("CODE:\n\n", code)
    		res, err := jsCtx.Eval(code, "name.js")
    		fmt.Println("result:", res, " error:", err)
    	}()
    

    When I run this code, I get:

    ==== C stack trace ===============================
    
    [end of stack trace]
    Segmentation fault: 11
    

    There's nothing in the stack trace.

    if I change return doesNotExist for something like return 5*5, it works correctly, so I thought there was a problem with handling ReferenceErrors, but I tried creating a small test case with code that causes a reference error, both in the global scope and inside a function, and none of them cause a segmentation fault.

    I also got a segmentation fault when I tried creating a context from an isolate that was created with a snapshot of the JS code above, except the 2 last lines.

    Let me know if you need any other information. I've never worked with C or C++, so I'm not really sure how to debug this.

  • go get cmd returns missing header file

    go get cmd returns missing header file

    Hi there, thanks for this library. I just tried to go get and the compiler returns missing 'libplatform.h' file not found. I attempted to attach a darwin 10.11, x64.release libplatform header to this thread but github does not support this filetype. Let me know if you would like me to email it or if you prefer a pull request. I'm not sure if you find it useful to include it to this package.

  • Latest V8 fails go tests.

    Latest V8 fails go tests.

    I've tested this on both Ubuntu 18.04 and 20.04.

    The steps I did was as follows:

    apt-get update
    apt install git curl wget vim golang python -y
    mkdir -p /usr/src/
    cd /usr/src/
    git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
    export PATH=/usr/src/depot_tools:$PATH
    fetch v8
    cd v8 
    gclient sync
    ./build/install-build-deps.sh
    gn gen out.gn/golib --args="strip_debug_info=true v8_use_external_startup_data=false v8_enable_i18n_support=false v8_enable_gdbjit=false v8_static_library=true symbol_level=0"
    ninja -C out.gn/golib
    go get -d github.com/augustoroman/v8
    cd ~/go/src/github.com/augustoroman/v8/
    ./symlink.sh /usr/src/v8/out/x64.release/
    DATESTAMP=$(date +"%y%m%d")
    mkdir "/usr/src/v8-build-${DATESTAMP}"
    cd "/usr/src/v8-build-${DATESTAMP}"
    cp -rfvp /usr/src/v8/out.gn out.gn
    cp -rfvp /usr/src/v8/include include
    cd ~/go/src/github.com/augustoroman/v8
    go test
    

    The output is as follows

    root@velocity:~/go/src/github.com/augustoroman/v8# go test
    # github.com/augustoroman/v8
    v8_c_bridge.cc: In function ‘String DupString(const v8::Local<v8::Value>&)’:
    v8_c_bridge.cc:43:45: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(const v8::Local<v8::Value>&)’
       return DupString(v8::String::Utf8Value(val));
                                                 ^
    In file included from v8_c_bridge.cc:4:0:
    ./include/v8.h:3285:5: note: candidate: v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Local<v8::Value>)
         Utf8Value(Isolate* isolate, Local<v8::Value> obj);
         ^~~~~~~~~
    ./include/v8.h:3285:5: note:   candidate expects 2 arguments, 1 provided
    v8_c_bridge.cc: In function ‘KindMask v8_Value_KindsFromLocal(v8::Local<v8::Value>)’:
    v8_c_bridge.cc:104:14: error: ‘class v8::Value’ has no member named ‘IsWebAssemblyCompiledModule’
       if (value->IsWebAssemblyCompiledModule())
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    v8_c_bridge.cc: In function ‘std::__cxx11::string str(v8::Local<v8::Value>)’:
    v8_c_bridge.cc:111:32: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>&)’
       v8::String::Utf8Value s(value);
                                    ^
    In file included from v8_c_bridge.cc:4:0:
    ./include/v8.h:3285:5: note: candidate: v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Local<v8::Value>)
         Utf8Value(Isolate* isolate, Local<v8::Value> obj);
         ^~~~~~~~~
    ./include/v8.h:3285:5: note:   candidate expects 2 arguments, 1 provided
    v8_c_bridge.cc: In function ‘std::__cxx11::string report_exception(v8::Isolate*, v8::Local<v8::Context>, v8::TryCatch&)’:
    v8_c_bridge.cc:158:29: error: no matching function for call to ‘v8::TryCatch::StackTrace()’
       if (!try_catch.StackTrace().IsEmpty()) {
                                 ^
    In file included from v8_c_bridge.cc:4:0:
    ./include/v8.h:10082:50: note: candidate: static v8::MaybeLocal<v8::Value> v8::TryCatch::StackTrace(v8::Local<v8::Context>, v8::Local<v8::Value>)
       V8_WARN_UNUSED_RESULT static MaybeLocal<Value> StackTrace(
                                                      ^~~~~~~~~~
    ./include/v8.h:10082:50: note:   candidate expects 2 arguments, 0 provided
    ./include/v8.h:10090:43: note: candidate: v8::MaybeLocal<v8::Value> v8::TryCatch::StackTrace(v8::Local<v8::Context>) const
       V8_WARN_UNUSED_RESULT MaybeLocal<Value> StackTrace(
                                               ^~~~~~~~~~
    ./include/v8.h:10090:43: note:   candidate expects 1 argument, 0 provided
    v8_c_bridge.cc:159:68: error: no matching function for call to ‘v8::TryCatch::StackTrace()’
         ss << std::endl << "Stack trace: " << str(try_catch.StackTrace());
                                                                        ^
    In file included from v8_c_bridge.cc:4:0:
    ./include/v8.h:10082:50: note: candidate: static v8::MaybeLocal<v8::Value> v8::TryCatch::StackTrace(v8::Local<v8::Context>, v8::Local<v8::Value>)
       V8_WARN_UNUSED_RESULT static MaybeLocal<Value> StackTrace(
                                                      ^~~~~~~~~~
    ./include/v8.h:10082:50: note:   candidate expects 2 arguments, 0 provided
    ./include/v8.h:10090:43: note: candidate: v8::MaybeLocal<v8::Value> v8::TryCatch::StackTrace(v8::Local<v8::Context>) const
       V8_WARN_UNUSED_RESULT MaybeLocal<Value> StackTrace(
                                               ^~~~~~~~~~
    ./include/v8.h:10090:43: note:   candidate expects 1 argument, 0 provided
    v8_c_bridge.cc: In function ‘void v8_init()’:
    v8_c_bridge.cc:171:42: error: ‘CreateDefaultPlatform’ is not a member of ‘v8::platform’
       v8::Platform *platform = v8::platform::CreateDefaultPlatform(
                                              ^~~~~~~~~~~~~~~~~~~~~
    v8_c_bridge.cc:171:42: note: suggested alternative: ‘NewDefaultPlatform’
       v8::Platform *platform = v8::platform::CreateDefaultPlatform(
                                              ^~~~~~~~~~~~~~~~~~~~~
                                              NewDefaultPlatform
    v8_c_bridge.cc: In function ‘StartupData v8_CreateSnapshotDataBlob(const char*)’:
    v8_c_bridge.cc:181:34: error: ‘CreateSnapshotDataBlob’ is not a member of ‘v8::V8’
       v8::StartupData data = v8::V8::CreateSnapshotDataBlob(js);
                                      ^~~~~~~~~~~~~~~~~~~~~~
    v8_c_bridge.cc: In function ‘ValueTuple v8_Context_Run(ContextPtr, const char*, const char*)’:
    v8_c_bridge.cc:237:49: error: no matching function for call to ‘v8::Script::Compile(v8::MaybeLocal<v8::String>, v8::MaybeLocal<v8::String>)’
           v8::String::NewFromUtf8(isolate, filename));
                                                     ^
    In file included from v8_c_bridge.cc:4:0:
    ./include/v8.h:1597:51: note: candidate: static v8::MaybeLocal<v8::Script> v8::Script::Compile(v8::Local<v8::Context>, v8::Local<v8::String>, v8::ScriptOrigin*)
       static V8_WARN_UNUSED_RESULT MaybeLocal<Script> Compile(
                                                       ^~~~~~~
    ./include/v8.h:1597:51: note:   no known conversion for argument 1 from ‘v8::MaybeLocal<v8::String>’ to ‘v8::Local<v8::Context>’
    v8_c_bridge.cc:244:45: error: no matching function for call to ‘v8::Script::Run()’
       v8::Local<v8::Value> result = script->Run();
                                                 ^
    In file included from v8_c_bridge.cc:4:0:
    ./include/v8.h:1606:43: note: candidate: v8::MaybeLocal<v8::Value> v8::Script::Run(v8::Local<v8::Context>)
       V8_WARN_UNUSED_RESULT MaybeLocal<Value> Run(Local<Context> context);
                                               ^~~
    ./include/v8.h:1606:43: note:   candidate expects 1 argument, 0 provided
    v8_c_bridge.cc: In function ‘void* v8_Context_RegisterCallback(ContextPtr, const char*, const char*)’:
    v8_c_bridge.cc:267:43: error: no matching function for call to ‘v8::FunctionTemplate::New(v8::Isolate*&, void (&)(const v8::FunctionCallbackInfo<v8::Value>&), v8::MaybeLocal<v8::String>)’
           v8::String::NewFromUtf8(isolate, id));
                                               ^
    In file included from v8_c_bridge.cc:4:0:
    ./include/v8.h:6423:34: note: candidate: static v8::Local<v8::FunctionTemplate> v8::FunctionTemplate::New(v8::Isolate*, v8::FunctionCallback, v8::Local<v8::Value>, v8::Local<v8::Signature>, int, v8::ConstructorBehavior, v8::SideEffectType, const v8::CFunction*)
       static Local<FunctionTemplate> New(
                                      ^~~
    ./include/v8.h:6423:34: note:   no known conversion for argument 3 from ‘v8::MaybeLocal<v8::String>’ to ‘v8::Local<v8::Value>’
    v8_c_bridge.cc:268:58: error: no matching function for call to ‘v8::FunctionTemplate::SetClassName(v8::MaybeLocal<v8::String>)’
       cb->SetClassName(v8::String::NewFromUtf8(isolate, name));
                                                              ^
    In file included from v8_c_bridge.cc:4:0:
    ./include/v8.h:6496:8: note: candidate: void v8::FunctionTemplate::SetClassName(v8::Local<v8::String>)
       void SetClassName(Local<String> name);
            ^~~~~~~~~~~~
    ./include/v8.h:6496:8: note:   no known conversion for argument 1 from ‘v8::MaybeLocal<v8::String>’ to ‘v8::Local<v8::String>’
    v8_c_bridge.cc:269:45: error: no matching function for call to ‘v8::FunctionTemplate::GetFunction()’
       return new Value(isolate, cb->GetFunction());
                                                 ^
    In file included from v8_c_bridge.cc:4:0:
    ./include/v8.h:6441:46: note: candidate: v8::MaybeLocal<v8::Function> v8::FunctionTemplate::GetFunction(v8::Local<v8::Context>)
       V8_WARN_UNUSED_RESULT MaybeLocal<Function> GetFunction(
                                                  ^~~~~~~~~~~
    ./include/v8.h:6441:46: note:   candidate expects 1 argument, 0 provided
    v8_c_bridge.cc: In function ‘void go_callback(const v8::FunctionCallbackInfo<v8::Value>&)’:
    v8_c_bridge.cc:282:54: error: no matching function for call to ‘v8::StackTrace::GetFrame(int)’
         v8::Local<v8::StackFrame> frame(trace->GetFrame(0));
                                                          ^
    In file included from v8_c_bridge.cc:4:0:
    ./include/v8.h:2084:21: note: candidate: v8::Local<v8::StackFrame> v8::StackTrace::GetFrame(v8::Isolate*, uint32_t) const
       Local<StackFrame> GetFrame(Isolate* isolate, uint32_t index) const;
                         ^~~~~~~~
    ./include/v8.h:2084:21: note:   candidate expects 2 arguments, 1 provided
    v8_c_bridge.cc:313:65: error: no matching function for call to ‘v8::ReturnValue<v8::Value>::Set(Value&)’
         args.GetReturnValue().Set(*static_cast<Value*>(result.Value));
                                                                     ^
    In file included from v8_c_bridge.cc:4:0:
    ./include/v8.h:4218:18: note: candidate: template<class S> void v8::ReturnValue<T>::Set(const v8::Global<S>&) [with S = S; T = v8::Value]
       V8_INLINE void Set(const Global<S>& handle);
                      ^~~
    ./include/v8.h:4218:18: note:   template argument deduction/substitution failed:
    v8_c_bridge.cc:313:65: note:   ‘Value {aka v8::Persistent<v8::Value>}’ is not derived from ‘const v8::Global<T>’
         args.GetReturnValue().Set(*static_cast<Value*>(result.Value));
                                                                     ^
    In file included from v8_c_bridge.cc:4:0:
    ./include/v8.h:4220:18: note: candidate: template<class S> void v8::ReturnValue<T>::Set(const v8::TracedReferenceBase<S>&) [with S = S; T = v8::Value]
       V8_INLINE void Set(const TracedReferenceBase<S>& handle);
                      ^~~
    ./include/v8.h:4220:18: note:   template argument deduction/substitution failed:
    v8_c_bridge.cc:313:65: note:   ‘Value {aka v8::Persistent<v8::Value>}’ is not derived from ‘const v8::TracedReferenceBase<T>’
         args.GetReturnValue().Set(*static_cast<Value*>(result.Value));
                                                                     ^
    In file included from v8_c_bridge.cc:4:0:
    ./include/v8.h:4222:18: note: candidate: template<class S> void v8::ReturnValue<T>::Set(v8::Local<S>) [with S = S; T = v8::Value]
       V8_INLINE void Set(const Local<S> handle);
                      ^~~
    ./include/v8.h:4222:18: note:   template argument deduction/substitution failed:
    v8_c_bridge.cc:313:65: note:   ‘v8::Persistent<v8::Value>’ is not derived from ‘v8::Local<T>’
         args.GetReturnValue().Set(*static_cast<Value*>(result.Value));
                                                                     ^
    In file included from v8_c_bridge.cc:4:0:
    ./include/v8.h:11097:6: note: candidate: void v8::ReturnValue<T>::Set(bool) [with T = v8::Value]
     void ReturnValue<T>::Set(bool value) {
          ^~~~~~~~~~~~~~
    ./include/v8.h:11097:6: note:   no known conversion for argument 1 from ‘Value {aka v8::Persistent<v8::Value>}’ to ‘bool’
    ./include/v8.h:11068:6: note: candidate: void v8::ReturnValue<T>::Set(double) [with T = v8::Value]
     void ReturnValue<T>::Set(double i) {
          ^~~~~~~~~~~~~~
    ./include/v8.h:11068:6: note:   no known conversion for argument 1 from ‘Value {aka v8::Persistent<v8::Value>}’ to ‘double’
    ./include/v8.h:11074:6: note: candidate: void v8::ReturnValue<T>::Set(int32_t) [with T = v8::Value; int32_t = int]
     void ReturnValue<T>::Set(int32_t i) {
          ^~~~~~~~~~~~~~
    ./include/v8.h:11074:6: note:   no known conversion for argument 1 from ‘Value {aka v8::Persistent<v8::Value>}’ to ‘int32_t {aka int}’
    ./include/v8.h:11085:6: note: candidate: void v8::ReturnValue<T>::Set(uint32_t) [with T = v8::Value; uint32_t = unsigned int]
     void ReturnValue<T>::Set(uint32_t i) {
          ^~~~~~~~~~~~~~
    ./include/v8.h:11085:6: note:   no known conversion for argument 1 from ‘Value {aka v8::Persistent<v8::Value>}’ to ‘uint32_t {aka unsigned int}’
    ./include/v8.h:4237:18: note: candidate: template<class S> void v8::ReturnValue<T>::Set(S*) [with S = S; T = v8::Value]
       V8_INLINE void Set(S* whatever);
                      ^~~
    ./include/v8.h:4237:18: note:   template argument deduction/substitution failed:
    v8_c_bridge.cc:313:65: note:   mismatched types ‘S*’ and ‘v8::Persistent<v8::Value>’
         args.GetReturnValue().Set(*static_cast<Value*>(result.Value));
                                                                     ^
    v8_c_bridge.cc: In function ‘void* v8_Context_Create(ContextPtr, ImmediateValue)’:
    v8_c_bridge.cc:343:84: error: no matching function for call to ‘v8::Date::New(v8::Isolate*&, double&)’
         case tDATE:        return new Value(isolate, v8::Date::New(isolate, val.Float64)); break;
                                                                                        ^
    In file included from v8_c_bridge.cc:4:0:
    ./include/v8.h:5777:50: note: candidate: static v8::MaybeLocal<v8::Value> v8::Date::New(v8::Local<v8::Context>, double)
       static V8_WARN_UNUSED_RESULT MaybeLocal<Value> New(Local<Context> context,
                                                      ^~~
    ./include/v8.h:5777:50: note:   no known conversion for argument 1 from ‘v8::Isolate*’ to ‘v8::Local<v8::Context>’
    v8_c_bridge.cc: In function ‘ValueTuple v8_Value_Get(ContextPtr, PersistentValuePtr, const char*)’:
    v8_c_bridge.cc:373:93: error: no matching function for call to ‘v8::Object::Get(v8::Local<v8::Context>&, v8::MaybeLocal<v8::String>)’
       v8::Local<v8::Value> localValue = object->Get(ctx, v8::String::NewFromUtf8(isolate, field)).ToLocalChecked();
                                                                                                 ^
    In file included from v8_c_bridge.cc:4:0:
    ./include/v8.h:3715:43: note: candidate: v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, v8::Local<v8::Value>)
       V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                               ^~~
    ./include/v8.h:3715:43: note:   no known conversion for argument 2 from ‘v8::MaybeLocal<v8::String>’ to ‘v8::Local<v8::Value>’
    ./include/v8.h:3718:43: note: candidate: v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, uint32_t)
       V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                               ^~~
    ./include/v8.h:3718:43: note:   no known conversion for argument 2 from ‘v8::MaybeLocal<v8::String>’ to ‘uint32_t {aka unsigned int}’
    v8_c_bridge.cc: In function ‘Error v8_Value_Set(ContextPtr, PersistentValuePtr, const char*, PersistentValuePtr)’:
    v8_c_bridge.cc:426:78: error: no matching function for call to ‘v8::Object::Set(v8::Local<v8::Context>&, v8::MaybeLocal<v8::String>, v8::Local<v8::Value>&)’
         object->Set(ctx, v8::String::NewFromUtf8(isolate, field), new_value_local);
                                                                                  ^
    In file included from v8_c_bridge.cc:4:0:
    ./include/v8.h:3668:37: note: candidate: v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>)
       V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                         ^~~
    ./include/v8.h:3668:37: note:   no known conversion for argument 2 from ‘v8::MaybeLocal<v8::String>’ to ‘v8::Local<v8::Value>’
    ./include/v8.h:3671:37: note: candidate: v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)
       V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                         ^~~
    ./include/v8.h:3671:37: note:   no known conversion for argument 2 from ‘v8::MaybeLocal<v8::String>’ to ‘uint32_t {aka unsigned int}’
    v8_c_bridge.cc: In function ‘String v8_Value_String(ContextPtr, PersistentValuePtr)’:
    v8_c_bridge.cc:568:36: error: no matching function for call to ‘v8::Value::ToString()’
       return DupString(value->ToString());
                                        ^
    In file included from v8_c_bridge.cc:4:0:
    ./include/v8.h:2808:44: note: candidate: v8::MaybeLocal<v8::String> v8::Value::ToString(v8::Local<v8::Context>) const
       V8_WARN_UNUSED_RESULT MaybeLocal<String> ToString(
                                                ^~~~~~~~
    ./include/v8.h:2808:44: note:   candidate expects 1 argument, 0 provided
    v8_c_bridge.cc: In function ‘int v8_Value_Bool(ContextPtr, PersistentValuePtr)’:
    v8_c_bridge.cc:592:48: error: no matching function for call to ‘v8::Value::BooleanValue(v8::Local<v8::Context>&)’
       v8::Maybe<bool> val = value->BooleanValue(ctx);
                                                    ^
    In file included from v8_c_bridge.cc:4:0:
    ./include/v8.h:2856:8: note: candidate: bool v8::Value::BooleanValue(v8::Isolate*) const
       bool BooleanValue(Isolate* isolate) const;
            ^~~~~~~~~~~~
    ./include/v8.h:2856:8: note:   no known conversion for argument 1 from ‘v8::Local<v8::Context>’ to ‘v8::Isolate*’
    FAIL	github.com/augustoroman/v8 [build failed]
    
    
  • Accessing a nil *big.Float after v8 is initialized segfaults

    Accessing a nil *big.Float after v8 is initialized segfaults

    Accessing a nil *big.Float will cause a segfault after v8 has been initialized.

    Minimum Example

    // main.go
    package main
    
    import (
    	"fmt"
    
    	"github.com/augustoroman/v8"
    	"github.com/konradreiche/v8/crash"
    )
    
    func main() {
            var f *big.Float
    	fmt.Println(f)
    	_ = v8.NewIsolate().NewContext()
            fmt.Println(f)
    }
    

    What did I expect?

    <nil>
    <nil>
    

    What am I seeing instead?

    <nil>
    Received signal 11 SEGV_MAPERR 000000000000
    
    ==== C stack trace ===============================
    
     [0x000000d24234]
     [0x7fa5afb8ddd0]
     [0x0000004a32a7]
    [end of stack trace]
    signal: segmentation fault
    
  • Is there way to import go functions with receiver?

    Is there way to import go functions with receiver?

    I'd like to implementate and import a go-code lib, but I found no property or method of v8.CallbackArgs to get method caller.

    In other words, I can get function args with v8.CallbackArgs.Args or v8.CallbackArgs.Arg(int), but I cannot get receiver(sometimes called caller), which is usually used like below:

    $("test").each(f);
    

    If I implementate $ in golang, that's easy, how can I implementate the each method? or how can I get value of caller $("test) in a standard v8-style callback function?

    func each(args v8.CallbackArgs)(*v8.Value, error) {
        // how can I get value of $("test") here?
    }
    
  • The high concurrency multi goroutine error occur, Because goroutine is insecure?

    The high concurrency multi goroutine error occur, Because goroutine is insecure?

    fatal error: unexpected signal during runtime execution [signal SIGSEGV: segmentation violation code=0x80 addr=0x0 pc=0x11526f5]

    runtime stack: runtime.throw(0x1b7a492, 0x2a) /usr/local/go/src/runtime/panic.go:617 +0x72 runtime.sigpanic() /usr/local/go/src/runtime/signal_unix.go:374 +0x4a9

    goroutine 10967 [syscall]: runtime.cgocall(0x114ffc0, 0xc0013947d0, 0x7fa4ac003d00) /usr/local/go/src/runtime/cgocall.go:128 +0x5b fp=0xc0013947a0 sp=0xc001394768 pc=0x788c8b git.chinawayltd.com/g7s-foundation/dfp-server/vendor/github.com/augustoroman/v8._Cfunc_v8_Value_Bool(0x2f43260, 0x7fa4ac002d10, 0x0) _cgo_gotypes.go:379 +0x4d fp=0xc0013947d0 sp=0xc0013947a0 pc=0xf5bc0d git.chinawayltd.com/g7s-foundation/dfp-server/vendor/github.com/augustoroman/v8.(*Value).Bool.func1(0xc0032e3820, 0x4) /go/src/git.chinawayltd.com/g7s-foundation/dfp-server/vendor/github.com/augustoroman/v8/v8.go:361 +0xa4 fp=0xc001394818 sp=0xc0013947d0 pc=0xf630b4 git.chinawayltd.com/g7s-foundation/dfp-server/vendor/github.com/augustoroman/v8.(*Value).Bool(0xc0032e3820, 0xc003168430) /go/src/git.chinawayltd.com/g7s-foundation/dfp-server/vendor/github.com/augustoroman/v8/v8.go:361 +0x2b fp=0xc001394838 sp=0xc001394818 pc=0xf5d9eb git.chinawayltd.com/g7s-foundation/dfp-server/javascript/helpers.GetSpecifiedType(0x1ae8a60, 0xc0032e3820, 0x1, 0xc000106140, 0x20) /go/src/git.chinawayltd.com/g7s-foundation/dfp-server/javascript/helpers/kind.go:107 +0x193 fp=0xc0013948d0 sp=0xc001394838 pc=0x10976c3 git.chinawayltd.com/g7s-foundation/dfp-server/services/repeater.(*Adapter).invokingFilterPlugin(0xc0031a08c0, 0x1ba1f18) /go/src/git.chinawayltd.com/g7s-foundation/dfp-server/services/repeater/adapter.go:246 +0x353 fp=0xc001394a60 sp=0xc0013948d0 pc=0x1145493 git.chinawayltd.com/g7s-foundation/dfp-server/services/repeater.(*Adapter).Push(0xc0031a08c0, 0xc000776420, 0xc0004d4d70) /go/src/git.chinawayltd.com/g7s-foundation/dfp-server/services/repeater/adapter.go:726 +0xb9 fp=0xc001394ad0 sp=0xc001394a60 pc=0x114a239 git.chinawayltd.com/g7s-foundation/dfp-server/services/repeater.(*repeater).push(0xc00001e0b0, 0xc000519d40, 0x24, 0x6c, 0x2b, 0xc002873560, 0x90, 0x0, 0x0, 0x0, ...) /go/src/git.chinawayltd.com/g7s-foundation/dfp-server/services/repeater/achieve.go:319 +0x2f2 fp=0xc001394bb0 sp=0xc001394ad0 pc=0x1142bf2 git.chinawayltd.com/g7s-foundation/dfp-server/services/repeater.(*repeater).DoWork.func1(0xc00001e0b0, 0xc000574000, 0xc0005b69c0, 0xc000519d40, 0x24, 0x6c, 0x2b, 0xc002873560, 0x90, 0x0, ...) /go/src/git.chinawayltd.com/g7s-foundation/dfp-server/services/repeater/achieve.go:190 +0xf3 fp=0xc001394f48 sp=0xc001394bb0 pc=0x114c6b3 runtime.goexit() /usr/local/go/src/runtime/asm_amd64.s:1337 +0x1 fp=0xc001394f50 sp=0xc001394f48 pc=0x7e2aa1 created by git.chinawayltd.com/g7s-foundation/dfp-server/services/repeater.(*repeater).DoWork /go/src/git.chinawayltd.com/g7s-foundation/dfp-server/services/repeater/achieve.go:186 +0x607

    goroutine 1 [IO wait]: internal/poll.runtime_pollWait(0x7fa4c7304d20, 0x72, 0x0) /usr/local/go/src/runtime/netpoll.go:182 +0x56 internal/poll.(*pollDesc).wait(0xc00011c098, 0x72, 0x0, 0x0, 0x1b5abaa) /usr/local/go/src/internal/poll/fd_poll_runtime.go:87 +0x9b internal/poll.(*pollDesc).waitRead(...) /usr/local/go/src/internal/poll/fd_poll_runtime.go:92 internal/poll.(*FD).Accept(0xc00011c080, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0) /usr/local/go/src/internal/poll/fd_unix.go:384 +0x1ba net.(*netFD).accept(0xc00011c080, 0xc00004a570, 0xc00004a500, 0x7919f9) /usr/local/go/src/net/fd_unix.go:238 +0x42 net.(*TCPListener).accept(0xc0004ca8d8, 0xc0004e3c08, 0xf013f1c5, 0xd7a42d7ce6d70c46) /usr/local/go/src/net/tcpsock_posix.go:139 +0x32 net.(*TCPListener).AcceptTCP(0xc0004ca8d8, 0xc0004e3c30, 0x84e646, 0x5d1859f6) /usr/local/go/src/net/tcpsock.go:247 +0x48 net/http.tcpKeepAliveListener.Accept(0xc0004ca8d8, 0xc0004e3c80, 0x18, 0xc000000180, 0xa5ba84) /usr/local/go/src/net/http/server.go:3264 +0x2f net/http.(*Server).Serve(0xc0004d8b60, 0x1d15080, 0xc0004ca8d8, 0x0, 0x0) /usr/local/go/src/net/http/server.go:2859 +0x22d net/http.(*Server).ListenAndServe(0xc0004d8b60, 0xc0004d8b60, 0xc000169de0) /usr/local/go/src/net/http/server.go:2797 +0xe4 net/http.ListenAndServe(...) /usr/local/go/src/net/http/server.go:3037 git.chinawayltd.com/g7s-foundation/dfp-server/vendor/github.com/gin-gonic/gin.(*Engine).Run(0xc000262900, 0xc000169e70, 0x1, 0x1, 0x0, 0x0) /go/src/git.chinawayltd.com/g7s-foundation/dfp-server/vendor/github.com/gin-gonic/gin/gin.go:294 +0x140 git.chinawayltd.com/g7s-foundation/dfp-server/vendor/git.chinawayltd.com/go-spec/tools/gin_app.(*GinApp).Start(0x29e1ca0) /go/src/git.chinawayltd.com/g7s-foundation/dfp-server/vendor/git.chinawayltd.com/go-spec/tools/gin_app/gin.go:75 +0x218 git.chinawayltd.com/g7s-foundation/dfp-server/operations.Start() /go/src/git.chinawayltd.com/g7s-foundation/dfp-server/operations/routes.go:45 +0x4d main.main() /go/src/git.chinawayltd.com/g7s-foundation/dfp-server/main.go:12 +0xb3

  • Issue with GO111MODULE=on

    Issue with GO111MODULE=on

    I'm having some trouble with enabling GO111MODULE=on. I was able to go through the whole process of setting up the repository and building V8 from scratch. When I run go test I get the following result:

    PASS
    ok  	github.com/augustoroman/v8	9.433s
    

    I installed the package at $GOPATH/src/github.com/augustoroman/v8. Everything seems to work well on OS X so far. However when I attempt importing with import "github.com/augustoroman/v8" in my own separate project I got a complaint. Remembering back I realized that I have GO111MODULE=on enabled. This prompted me to add a go.mod with the following in the root of the v8 folder:

    module github.com/augustoroman/v8
    go 1.12
    

    When I attempt running I get another error:

    go: finding github.com/augustoroman/v8 latest
    go: downloading github.com/augustoroman/v8 v8.0.0-20190418063024-4b66934a28a7
    main.go:3:8: unknown import path "github.com/augustoroman/v8": cannot find module providing package github.com/augustoroman/v8
    

    Any suggestions on how to resolve this issue?

  • Segfault when creating snapshot

    Segfault when creating snapshot

    First off, thanks for the library-- its nice to find language bindings that already exist.

    I've been toying around with it, and I've got most things working, but I seem to occasionally run into issues which cause segfaults. The main one I'm hitting now is around snapshots. I have been unable to reproduce it with a trivial example (I'm continuing to try, but figured I'd open the issue in case its already known). I have a JS file (its a webpack compiled js file of a react app), and when I Eval() it in a normal context all is well, but if I instead attempt to create a snapshot out of it -- I get the following segfault:

    (gdb) bt full
    #0  runtime.raise () at /usr/local/go/src/runtime/sys_linux_amd64.s:146
    No locals.
    #1  0x00000000007b7b9b in runtime.dieFromSignal (sig=6) at /usr/local/go/src/runtime/signal_unix.go:424
    No locals.
    #2  0x00000000007b8138 in runtime.sigfwdgo (ctx=0xc00055f9c0, info=0xc00055faf0, sig=6, ~r3=<optimized out>) at /usr/local/go/src/runtime/signal_unix.go:629
            flags = <optimized out>
            fwdFn = <optimized out>
            g = <optimized out>
    #3  0x00000000007b73f8 in runtime.sigtrampgo (ctx=0xc00055f9c0, info=0xc00055faf0, sig=<optimized out>) at /usr/local/go/src/runtime/signal_unix.go:289
            g = <optimized out>
            gsignalStack = <optimized out>
            setStack = <optimized out>
            sp = <optimized out>
    #4  0x00000000007d3913 in runtime.sigtramp () at /usr/local/go/src/runtime/sys_linux_amd64.s:353
    No locals.
    #5  <signal handler called>
    No locals.
    #6  runtime.raise () at /usr/local/go/src/runtime/sys_linux_amd64.s:146
    No locals.
    #7  0x00000000007b7b9b in runtime.dieFromSignal (sig=6) at /usr/local/go/src/runtime/signal_unix.go:424
    No locals.
    #8  0x00000000007b7d5a in runtime.crash () at /usr/local/go/src/runtime/signal_unix.go:518
    No locals.
    #9  0x00000000007ce6e4 in runtime.fatalthrow.func1 () at /usr/local/go/src/runtime/panic.go:667
            gp = 0xc00013ec00
            pc = 8003906
            sp = 140298839633024
    #10 0x00000000007a2307 in runtime.fatalthrow () at /usr/local/go/src/runtime/panic.go:660
            gp = <optimized out>
            pc = <optimized out>
            sp = <optimized out>
    #11 0x00000000007a2142 in runtime.throw (s=...) at /usr/local/go/src/runtime/panic.go:608
            gp = <optimized out>
    #12 0x00000000007b7b52 in runtime.sigpanic () at /usr/local/go/src/runtime/signal_unix.go:374
            g = <optimized out>
    ---Type <return> to continue, or q <return> to quit--- 
    #13 0x0000000000e064d5 in v8::internal::PartialSerializer::SerializeEmbedderFields() ()
    No symbol table info available.
    #14 0x0000000000e06bc4 in v8::internal::PartialSerializer::Serialize(v8::internal::Object**, bool) ()
    No symbol table info available.
    #15 0x0000000000adfd18 in v8::SnapshotCreator::CreateBlob(v8::SnapshotCreator::FunctionCodeHandling) ()
    No symbol table info available.
    #16 0x0000000000ae03d1 in v8::V8::CreateSnapshotDataBlob(char const*) ()
    No symbol table info available.
    #17 0x0000000000aa7919 in v8_CreateSnapshotDataBlob (js=<optimized out>) at v8_c_bridge.cc:181
            data = <optimized out>
    #18 0x0000000000aa59cd in _cgo_8127a7a1550c_Cfunc_v8_CreateSnapshotDataBlob (v=0xc00008da00) at cgo-gcc-prolog:145
            _cgo_a = 0xc00008da00
            _cgo_stktop = 0xc00008e000 ""
            _cgo_r = <optimized out>
    #19 0x00000000007d14b0 in runtime.asmcgocall () at /usr/local/go/src/runtime/asm_amd64.s:637
    No locals.
    #20 0x00007f9a04a62188 in ?? ()
    No symbol table info available.
    #21 0x00007f99de7fbe28 in ?? ()
    No symbol table info available.
    #22 0x00000000007cdc43 in runtime.mProf_Malloc.func1 () at /usr/local/go/src/runtime/mprof.go:357
            b = 0x0
            p = 0x7d3624 <runtime.raise+20>
    #23 0x000000c00011e480 in ?? ()
    No symbol table info available.
    #24 0x00000000007a6a30 in ?? () at /usr/local/go/src/runtime/proc.go:1146
    No locals.
    #25 0x0000000000000000 in ?? ()
    No symbol table info available.
    

    Any pointers for debugging this? It (1) seems odd that Eval and Snapshot would give different behavior for the same string (no go injected values etc.) (2) this seems like something that the bindings should return as an error instead of a panic -- right now the CreateSnapshot() method doesn't return an error which is odd.

  • grexie/go-v8

    grexie/go-v8

    @augustoroman There is a repository in a company which I have now closed which contains an rewrite of your library following the same design patterns you have in your project. Please could you take a look through this repository: grexie/go-v8 and take from it what you think is useful. Please do not attribute copyright to me, it is yours to have.

    I had a lot of help from the Lord God in writing the additions I placed in there. He showed me how to write every single line of code.

    This code is for you.

v8 javascript engine binding for golang

Go-V8 V8 JavaScript engine bindings for Go. Features Thread safe Thorough and careful testing Boolean, Number, String, Object, Array, Regexp, Function

Nov 21, 2022
A JavaScript interpreter in Go (golang)

otto -- import "github.com/robertkrimen/otto" Package otto is a JavaScript parser and interpreter written natively in Go. http://godoc.org/github.com/

Jan 2, 2023
Execute JavaScript from Go
Execute JavaScript from Go

Execute JavaScript from Go Usage import "rogchap.com/v8go" Running a script ctx, _ := v8go.NewContext() // creates a new V8 context with a new Isolate

Jan 9, 2023
❄️ Elsa is a minimal, fast and secure runtime for JavaScript and TypeScript written in Go

Elsa Elsa is a minimal, fast and secure runtime for JavaScript and TypeScript written in Go, leveraging the power from QuickJS. Features URL based imp

Jan 7, 2023
Go bindings to QuickJS: a fast, small, and embeddable ES2020 JavaScript interpreter.

quickjs Go bindings to QuickJS: a fast, small, and embeddable ES2020 JavaScript interpreter. These bindings are a WIP and do not match full parity wit

Dec 28, 2022
⛳ A minimal programming language inspired by Ink, JavaScript, and Python.

⛳ Golfcart My blog post: Creating the Golfcart Programming Language Getting Started Scope Rules Usage Building and tests Contributions License Golfcar

Sep 6, 2022
Expression evaluation engine for Go: fast, non-Turing complete, dynamic typing, static typing
Expression evaluation engine for Go: fast, non-Turing complete, dynamic typing, static typing

Expr Expr package provides an engine that can compile and evaluate expressions. An expression is a one-liner that returns a value (mostly, but not lim

Dec 30, 2022
Sabre is highly customisable, embeddable LISP engine for Go. :computer:

Sabre DEPRECATED: This repository is deprecated in favour much better slurp project and will be archived/removed soon. Sabre is highly customizable, e

May 23, 2021
Go bindings for Lua C API - in progress

Go Bindings for the lua C API Simplest way to install: # go get github.com/aarzilli/golua/lua You can then try to run the examples: $ cd golua/_examp

Dec 28, 2022
naive go bindings to the CPython C-API

go-python Naive go bindings towards the C-API of CPython-2. this package provides a go package named "python" under which most of the PyXYZ functions

Dec 30, 2022
Duktape JavaScript engine bindings for Go

Duktape bindings for Go(Golang) Duktape is a thin, embeddable javascript engine. Most of the api is implemented. The exceptions are listed here. Usage

Jan 6, 2023
ECMAScript/JavaScript engine in pure Go

Goja is an implementation of ECMAScript 5.1 in pure Go with emphasis on standard compliance and performance.

Jan 1, 2023
ECMAScript/JavaScript engine in pure Go

goja ECMAScript 5.1(+) implementation in Go. Goja is an implementation of ECMAScript 5.1 in pure Go with emphasis on standard compliance and performan

Dec 29, 2022
v8 javascript engine binding for golang

Go-V8 V8 JavaScript engine bindings for Go. Features Thread safe Thorough and careful testing Boolean, Number, String, Object, Array, Regexp, Function

Nov 21, 2022
ECMAScript/JavaScript engine in pure Go

goja ECMAScript 5.1(+) implementation in Go. Goja is an implementation of ECMAScript 5.1 in pure Go with emphasis on standard compliance and performan

Jan 1, 2023
This library provides WebAssembly capability for goja Javascript engine

This module provides WebAssembly functions into goja javascript engine.

Jan 10, 2022
Golang-WASM provides a simple idiomatic, and comprehensive API and bindings for working with WebAssembly for Go and JavaScript developers
Golang-WASM provides a simple idiomatic, and comprehensive API and bindings for working with WebAssembly for Go and JavaScript developers

A bridge and bindings for JS DOM API with Go WebAssembly. Written by Team Ortix - Hamza Ali and Chan Wen Xu. GOOS=js GOARCH=wasm go get -u github.com/

Dec 22, 2022
Fluent JavaScript API for SharePoint and Microsoft Graph REST APIs
Fluent JavaScript API for SharePoint and Microsoft Graph REST APIs

PnPjs is a fluent JavaScript API for consuming SharePoint and Microsoft Graph REST APIs in a type-safe way. You can use it with SharePoint Framework,

Dec 23, 2022
A full-featured regex engine in pure Go based on the .NET engine

regexp2 - full featured regular expressions for Go Regexp2 is a feature-rich RegExp engine for Go. It doesn't have constant time guarantees like the b

Jan 9, 2023
Qt binding for Go (Golang) with support for Windows / macOS / Linux / FreeBSD / Android / iOS / Sailfish OS / Raspberry Pi / AsteroidOS / Ubuntu Touch / JavaScript / WebAssembly

Introduction Qt is a free and open-source widget toolkit for creating graphical user interfaces as well as cross-platform applications that run on var

Jan 2, 2023