A Go API for the V8 javascript engine.

go get


V8 Bindings for Go GoDoc

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

The bindings are tested to work with v8 build 5.4.374.0 (latest dev at the time of writing). 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:


In order for the bindings to compile correctly, one needs to:

  1. Compile v8 as a static library.
  2. Let cgo know where the library is located.

Compiling v8.

Download v8:

Lets say you've checked out the v8 source into $V8, go-v8 into $GO_V8 and want to place the static v8 library into $GO_V8/libv8/. (For example, export GO_V8=$GOPATH/src/



make x64.release GYPFLAGS="-Dv8_use_external_startup_data=0 -Dv8_enable_i18n_support=0 -Dv8_enable_gdbjit=0"`

If build system produces a thin archive, you want to make it into a fat one:

for lib in `find out/x64.release/ -name '*.a'`;
  do ar -t $lib | xargs ar rvs $ && mv -v $ $lib;

Symlink the libraries and include directory to the Go package dir:

ln -s `pwd`/out/x64.release ${GO_V8}/libv8
ln -s `pwd`/include ${GO_V8}/include


To build: (substitute in your OS X version: sw_vers -productVersion)

GYP_DEFINES="mac_deployment_target=10.11" \
make -j5 x64.release GYPFLAGS="-Dv8_use_external_startup_data=0 -Dv8_enable_i18n_support=0 -Dv8_enable_gdbjit=0"

On MacOS, the resulting libraries contain debugging information by default (even though we've built the release version). As a result, the binaries are 30x larger, then they should be. Strip that to reduce the size of the archives (and build times!) very significantly:

strip -S out/x64.release/libv8_*.a

Symlink the libraries and include directory to the Go package dir:

ln -s `pwd`/out/x64.release ${GO_V8}/libv8
ln -s `pwd`/include ${GO_V8}/include


Also relevant is the v8 API release changes doc:


This work is based off of several existing libraries: