Artifact cbb29ed422b1ce05347ec84863bee649dd9cc249c98d7e1cdac5803ac81b4f70:
- File
examples/tinygo/README.md
— part of check-in
[b451efa274]
at
2026-10-31 16:23:44
on branch main
— docs: the libfossil_noslog tag, and how the publisher engine gets smaller still
The TinyGo section of the install guide and examples/tinygo described libfossil_nohttp but not libfossil_noslog, which only the changelog mentioned. Both now say what the tag leaves out and what changes.
The install guide gains a "Smaller still" section pointing at the html-artifact-publisher engine's build: no scheduler, a reactor export, explicit panic unwinding and a patched standard library, with the behavior the patch changes. It says plainly that these steps are the publisher's and that this repository does not build that way.
CI never compiled the code behind either tag, so a change could break a tagged embedder unnoticed until the publisher's CI ran against a release. A new build-size-tags job builds the library under both tags, vets the repository under libfossil_noslog, and runs the check-in linker's tests under it. (user: [email protected], size: 2206) [annotate] [blame] [check-ins using] [more...]
# tinygo (js/wasm) The whole public API, including the HTTP sync client and signing, compiled with [TinyGo](https://tinygo.org) for the `wasm` (js) target. ``` tinygo build -target=wasm -no-debug -opt=z -stack-size=1MB -o libfossil.wasm ./examples/tinygo/ wasm-opt -Oz --detect-features --strip-debug --strip-producers libfossil.wasm -o libfossil.wasm ``` `-stack-size=1MB`: TinyGo's default goroutine stack is too small for go-libfossil's deeper paths. Measured for this program with TinyGo 0.43.0: the first row is the `Build (tinygo)` CI job; the others are macOS (Go 1.27.3, LLVM 22, Binaryen 133). | Build | Raw | gzip -9 | |---|---|---| | TinyGo, as CI builds it (Linux release, its own wasm-opt) | 3.52 MB | 1.26 MB | | TinyGo, then `wasm-opt -Oz` | 3.83 MB | 1.40 MB | | TinyGo | 4.02 MB | 1.44 MB | | Standard Go, `GOOS=js GOARCH=wasm -ldflags='-s -w'` | 16.1 MB | 4.06 MB | A program that leaves out sync (no `net/http`, no TLS) is smaller. A library embedder that never uses the HTTP transport or server can build with `-tags libfossil_nohttp`, which leaves `net/http` and its TLS code out (about 97 KB gzipped). This example does not build with that tag, since it calls `NewHTTPTransport`, and neither does the `cli` package. A tagged embedder supplies its own transport and serving, for example a `Transport` for `Sync` and its own request handling around `HandleSyncWithOpts`. `-tags libfossil_noslog` leaves `log/slog` out (about 33 KB gzipped): the check-in linker writes its info and warning messages to stderr instead and drops its debug messages. This example builds with it. For a program that needs to be smaller still, see "Smaller still" in the [install guide](../../docs/site/content/docs/get-started/install.md). No SQLite driver is imported here. A TinyGo host registers a `database/sql` driver over its own SQLite. The `ncruces` driver runs SQLite as an embedded wasm module and is for standard Go builds; the `modernc` driver has no wasm build. Under TinyGo two things behave differently, because TinyGo's standard library lacks what they use: a sync redirect ends the request with an error instead of being followed, and DNS failures are not classified as transient.