gen-app-cmds

command
v1.801.299 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Command gen-app-cmds generates one cmd/<app>/main.go per app in apps.Wire() so each app builds as its own standalone binary AND still mounts into the unified cloud binary. Adding an app in apps.Wire() is the one edit; this regenerates its cmd/<app> stub. Run via the go:generate directive in apps/apps.go: `go generate ./apps`.

The generated main rebuilds the app's ONE Wire() entry from that entry's own source text and imports only the app's own package. It must NOT import package apps: apps names every subsystem, so `apps.ServeSingle(name)` links all ~68 of them into every per-app binary — 3.2k packages and ~4.5GiB of RSS per link, which is what makes a full build OOM. Copying the entry's text keeps Wire() the single source of truth (nothing is hand-maintained, and a field added there appears here on the next run) while cutting the link down to the one app.

An entry the generator cannot express standalone falls back to the old apps.ServeSingle stub and says so on stderr, because a fat binary that runs beats a lean one that does not compile. Two shapes do that today: a field naming a helper defined in package apps (ctxShutdown, mountMetrics — they exist nowhere a standalone main can reach), and an entry built by a call rather than a literal (cloud.PluginSpec), which gets no generated main at all since a plugin app is already its own composition root with a hand-written entrypoint.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL