A compiler that translates Go code into JavaScript, enabling Go development for web browsers.
GopherJS is a compiler that translates Go programming language code into JavaScript, enabling developers to write client-side web applications in Go. It solves the problem of using Go's type safety, concurrency model, and tooling for browser-based projects, allowing Go code to run where only JavaScript is natively supported.
Go developers who want to build front-end web applications or share logic between server and client using the same language, and teams looking to leverage Go's ecosystem for full-stack development.
Developers choose GopherJS because it provides a nearly complete implementation of Go for the browser, including goroutines and the standard library, allowing them to apply Go's strengths to client-side development without switching languages or contexts.
A compiler from Go to JavaScript for running Go code in a browser
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Implements nearly all Go features, including goroutines and the standard library, as documented in the compatibility page, allowing developers to write idiomatic Go for the browser.
The `gopherjs serve` command provides live compilation and automatic rebuilding on changes, with errors displayed in both terminal and browser console for efficient debugging.
Generates source maps that let developers debug the original Go code directly in browser developer tools, improving the development experience.
Fully supports Go's goroutines, enabling concurrent programming in the browser through stack unwinding and restoration, a rare feature in client-side environments.
Cannot use Cgo, which limits access to C libraries and may hinder projects that rely on native extensions or system integrations.
Requires managing GOPHERJS_GOROOT for specific Go versions and setting GOOS on unsupported platforms, adding overhead compared to standard Go tooling.
Compiled JavaScript can be large, and performance tips advise using specific types like int over int64, indicating potential inefficiencies and bundle bloat.