Clientkit examples
These four programs are the minimum runnable path through Clientkit. They use
local servers and listeners, make no external requests, and require no
credentials or infrastructure.
Read order
- http-basic
- http-retry-and-classification
- tcp-tls
- kit-series-composition
What each example shows
- http-basic constructs an HTTP client with ordinary production
defaults, creates a relative request, uses
Do, and closes the caller-owned
response body.
- http-retry-and-classification combines a
stable operation name, response classification, body replay, retry policy,
semantic retry authorization, and structured results. It proves that adding
POST to a policy does not authorize an unsafe retry by itself.
- tcp-tls trusts a local certificate, establishes a verified TLS
connection, performs an application-owned exchange, and closes the returned
net.Conn.
- kit-series-composition composes Clientkit, Opskit,
Workerkit, and Servekit. Workerkit refreshes Clientkit health while Servekit
reads the cached readiness state without performing checks from
/readyz.
Run
The first three programs belong to Clientkit's root module:
go run ./examples/http-basic
go run ./examples/http-retry-and-classification
go run ./examples/tcp-tls
The cross-kit example is an isolated module so Servekit and Workerkit do not
enter Clientkit's published module graph:
go -C examples/kit-series-composition run .
Build and test the complete set with:
make build-examples
make verify
See the examples guide for the learning and safety
boundary of each program.