liveBook · Manning

WebAssembly

As explained in Learn Go with Pocket-Sized Projects

WebAssembly is a portable binary instruction format and execution environment for running compiled code on the web and other platforms.

WebAssembly (Wasm) is a portable, low-level compilation target for web applications. Go code is compiled into bytecode, then executed client-side by a Wasm interpreter loaded through JavaScript. section 12.0 section 12.1

A Wasm application connects several layers:

  • Compile Go into a Wasm executable. section 12.4
  • Load the executable inside an HTML page with JavaScript. section 12.4
  • Register Go functions for JavaScript and use the js package to interact with the DOM. section 12.4
  • Use the format to target browser applications from languages such as Go, Rust, Python, or C++. section 12.1
Figure 12.1 From Go code to Wasm executed by JavaScript
A diagram of a software system

Description automatically generated

Follow the pipeline from Go source through bytecode and a JavaScript-loaded interpreter to client-side Wasm execution. section 12.1

Browser application pipeline

A Go application can be compiled into Wasm, loaded by JavaScript in an HTML page, and connected to browser behavior through registered Go functions and the DOM. section 12.4

How Learn Go with Pocket-Sized Projects covers it

How deep it goes
Explains the Go-to-bytecode-to-interpreter pipeline and JavaScript integration, but stops short of detailed runtime internals.
Examples
Uses Go source, compiled bytecode, a JavaScript interpreter library, an HTML page, and registered DOM-facing functions.
What you can do after
Build browser modules from Go, load them with JavaScript, and connect exported functions to the DOM.
How it connects
Connects Go, JavaScript, HTML, the DOM, browser execution, and language-agnostic compilation.

Also explained in

Compare how 5 books explain WebAssembly →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn Go with Pocket-Sized Projects. The section links point to the parts of the book it draws on.