Generate and regenerate a Go project
Inputs and first run
You need a manifest that follows the schema, an output directory, and a target Go version matching the project. From the project directory:
go-sdk-generator generate -i generate.yml -o . --go-version 1.27.3
Replace the Go version with the version your project uses. -i/--input selects the manifest, -o/--output selects the destination, and -g/--go-version selects the target Go version. Use go-sdk-generator generate --help for current options. The generator validates the manifest before producing files.
After generation, run these commands from each directory containing a generated go.mod:
go mod tidy
go generate ./...
go test ./...
go mod tidy resolves dependencies; go generate ./... runs generated directives, such as mock generation. Implement the generated operation stubs in Go and test the resulting behaviour. The manifest is the source of truth for the surface, not an implementation of the operations.
Also review generated repository automation files such as pyproject.toml and .github/workflows/. Top-level manifest settings like tag_latest and update_copyright_headers change those outputs. On an existing project, use --overwrite to update stateful generated files such as pyproject.toml and the workflows. If you turn off automatic copyright maintenance, remove any previously generated licensing workflow that remains in the project.
For a multi-module workspace, repeat the commands in each generated module rather than running go mod tidy from the workspace root. See what the generator produces for the distinction between generated scaffolding and handwritten logic.
Change the contract later
- Edit the manifest, checking manifest authoring for type and compatibility guidance.
- Re-run
go-sdk-generator generatewith the same input, output, and Go version. - Review the file diff before accepting it. Generation preserves stateful files by default;
--overwritealso regenerates them, including files such asgo.mod. Use it only when you intend to replace and review that state. - Run
go mod tidy,go generate ./..., and the project's tests again in each affected Go module. Keep handwritten operation logic and project-specific wiring when resolving changes.
This repository generates parts of itself from generate.yml. Its development guide covers the repository-specific workflow. For CLI configuration, logging, and the full generated interface, consult DOCUMENTATION.md.