metaengine-protobuf-go-nethttp
Protobuf 3 → an idiomatic Go net/http client and message structs over gRPC-Connect, with context.Context methods, pointer types for optional fields, and typed Connect protocol errors (no HTTP-status routing). Delivered as a self-contained single binary — no .NET runtime required.
Pick your registry
The same generator, published to every ecosystem we support. Install however your project expects.
Drive it from the CLI or programmatically
GitHub Releases ships a zero-config CLI. NuGet ships the same generator as a C# fluent API — same options, same output.
After install, point the CLI at your schema. It writes the generated tree to your chosen output directory.
metaengine-protobuf-go-nethttp <input> <output> <module> <package> [flags]Generates an idiomatic Go net/http gRPC-Connect client and message structs from Protobuf 3 .proto files. Ships as a self-contained single binary (go install / brew / shell) — no .NET runtime required.
metaengine-protobuf-go-nethttp service.proto ./client github.com/acme/api clientmetaengine-protobuf-go-nethttp service.proto ./client github.com/acme/api client \
--documentation \
--retries 3metaengine-protobuf-go-nethttp service.proto ./client github.com/acme/api client \
--bearer-auth API_TOKEN \
--header X-Tenant-ID:TENANT_ID \
--clean \
--verboseEvery knob, documented
Every option is available on the C# fluent API as a method, and most are also exposed as CLI flags. Cross-cutting auth, headers, retries and timeouts apply across frameworks.
Go Options
6WithDocumentation()Generate Go doc comments on structs and service methodsWithContext()Take context.Context as the first parameter on every method (idiomatic Go; on by default)WithPointersForOmittable()Generate *T pointer types for optional fields so absence is distinguishable from the zero valueWithValidateStructTags()Emit validate:"…" struct tags for github.com/go-playground/validator (off by default — no implicit third-party dependency)WithMethodNames(Func)Custom method naming rule with access to operation contextWithOptionsObjectThreshold(int)Parameter count before an options struct is used (default: 4)
Auth · Headers · Resilience
12WithMiddleware()Generate RoundTripper middleware infrastructure (Middleware type + ChainMiddleware + NewHTTPClientWithMiddleware)WithBearerAuth()Bearer token from env var (default API_TOKEN) — adds an Authorization header at the transport layerWithBearerAuth(string)Bearer token from a specific env var nameWithBearerAuth(string, string)Bearer token with a custom header name (e.g. X-Api-Key)WithBasicAuth(string, string)HTTP Basic auth — username + password read from these env vars (defaults API_USERNAME / API_PASSWORD)WithCustomHeader(string, string)Static header sourced from an env var. Repeatable (e.g. X-Tenant-ID ← TENANT_ID)WithBaseUrlEnvVar(string)Environment variable name for the base URL, read at runtime (default: API_BASE_URL)WithTimeout(double)Request timeout in seconds for all operations (sets the net/http client timeout)WithTimeout(double?, double?, double?, double?)Granular timeout: connect · read · write · pool (null = use default)WithRetries()HTTP retries with exponential backoff over connectUnary (default status 429, 503)WithRetries(int)Retries with a custom max attempt countWithRetries(int, double, double, int[])Retries with max attempts, base delay (s), max delay (s), and custom retryable status codes
Protobuf Options
2WithTypeFilter(Func)Filter extracted proto types (messages + enums) before registration — only types returning true are generatedWithTypeMapping(string, Type)Override the protobuf well-known-type mapping by fully-qualified name (e.g. google.protobuf.Timestamp → string)
Naming Transformations
3Types(Func)Transform type namesPaths(Func)Transform output pathsFileNames(Func)Transform file names
File Management
5CleanDestination()Clean output directory before generationAlwaysOverwrite()Always overwrite existing filesOnlyWhenModelChanged()Update only when model changesOnlyWhenNew()Write only new files, preserve existingCleanDirectories(...)Clean specific subdirectories
Diagnostics
2Verbose()Enable verbose loggingWithLogger(Action<string>)Route generation log output to a custom sink