Documentation
¶
Overview ¶
Command sdk writes the public sdk package's generated files from the engine: sdk/sdk_gen.go, the functions, constants and variables an embedding caller uses, and sdk/types_gen.go, a type alias for every engine type that caller has to be able to name.
The engine lives under internal/, so a caller outside this module cannot import it. The sdk package re-exports the embedding surface. Which declarations that is, is marked where they are declared: an `//sdk:export` line in a declaration's doc comment exports it, and `//sdk:export Name` exports it under another name. On a const or var block the directive exports every name in the block; on one spec inside a block it exports only that spec. The doc comment, without the directive, becomes the sdk's doc.
Functions become one-line wrappers rather than variables, so the sdk's documentation lists them as functions, and generic ones keep their type parameters. Types are aliases rather than copies, so a value built through sdk is the engine's own value. Beyond the exported types, every registered task and every named engine type reachable from an exported type, function signature or constant through exported fields is aliased too: writing that list by hand would miss the next task someone adds, so it is derived here, and TestGeneratedSDKIsCurrent fails when a committed file falls behind.
Because the surface is generated, a rebase that conflicts in either file is settled by regenerating it.
It is run by `go generate` from the sdk directory, which is where the output is written.