Directories
¶
| Path | Synopsis |
|---|---|
|
Package atomicfile writes a file through a temp file and a rename, so a reader sees the old content or the new content, never a partial file.
|
Package atomicfile writes a file through a temp file and a rename, so a reader sees the old content or the new content, never a partial file. |
|
Package cli builds the Cobra tree of a tool by contract.md section 9.2: Root makes the root with the persistent --format flag and the doctor subcommand, Group makes a command that only holds subcommands, Command makes a leaf.
|
Package cli builds the Cobra tree of a tool by contract.md section 9.2: Root makes the root with the persistent --format flag and the doctor subcommand, Group makes a command that only holds subcommands, Command makes a leaf. |
|
clitest
Package clitest runs a tree made with cli in a test: one call gives the exit code, stdout and stderr of a command, and Lines gives the log lines it wrote.
|
Package clitest runs a tree made with cli in a test: one call gives the exit code, stdout and stderr of a command, and Lines gives the log lines it wrote. |
|
Package config loads an app's settings (contract.md section 9.5): a struct filled from `<Config>/config.json` by its json tags, then from the environment by its env tags, with `go-envconfig` as the one parser for both.
|
Package config loads an app's settings (contract.md section 9.5): a struct filled from `<Config>/config.json` by its json tags, then from the environment by its env tags, with `go-envconfig` as the one parser for both. |
|
Package contracttest checks log lines against the d108 contract in a test.
|
Package contracttest checks log lines against the d108 contract in a test. |
|
Package doctor builds the report behind every tool's `doctor` subcommand (contract.md section 9.2): where the log lines go and why, the level and its source, the current log file, whether the agent answers on 127.0.0.1:4317, whether tracing is on, the version and the instance id.
|
Package doctor builds the report behind every tool's `doctor` subcommand (contract.md section 9.2): where the log lines go and why, the level and its source, the current log file, whether the agent answers on 127.0.0.1:4317, whether tracing is on, the version and the instance id. |
|
Package failure classes errors and maps the classes to the shared exit-code table of contract.md section 9.2.
|
Package failure classes errors and maps the classes to the shared exit-code table of contract.md section 9.2. |
|
Package httpserver wraps http.Server with the request middleware of work (one request.handled per request, a span, panic recovery), GET /healthz, optional CORS and optional pprof.
|
Package httpserver wraps http.Server with the request middleware of work (one request.handled per request, a span, panic recovery), GET /healthz, optional CORS and optional pprof. |
|
Package identity names the running program once: service.name, service.version, service.instance.id and the pid.
|
Package identity names the running program once: service.name, service.version, service.instance.id and the pid. |
|
internal
|
|
|
otelres
Package otelres builds the OTel resource tracing and metrics share, and holds their common on/off switch.
|
Package otelres builds the OTel resource tracing and metrics share, and holds their common on/off switch. |
|
Package lifecycle owns main: Run sets up logging, tracing and metrics from the identity, writes process.start, runs the app's function and takes every exit through one stop sequence (contract.md section 9.1).
|
Package lifecycle owns main: Run sets up logging, tracing and metrics from the identity, writes process.start, runs the app's function and takes every exit through one stop sequence (contract.md section 9.1). |
|
internal/run
Package run is the state of one lifecycle run and its stop sequence, shared by lifecycle (the process owner) and lifecycletest (the in-process harness).
|
Package run is the state of one lifecycle run and its stop sequence, shared by lifecycle (the process owner) and lifecycletest (the in-process harness). |
|
lifecycletest
Package lifecycletest runs a lifecycle.Func through the real stop sequence inside a test, so a service test sees its OnStop steps, Go goroutines and Stop calls behave as they do under lifecycle.Run: ctx cancelled, the Go goroutines drained, the steps in reverse order, fn waited for, process.stop or process.crash as the last line.
|
Package lifecycletest runs a lifecycle.Func through the real stop sequence inside a test, so a service test sees its OnStop steps, Go goroutines and Stop calls behave as they do under lifecycle.Run: ctx cancelled, the Go goroutines drained, the steps in reverse order, fn waited for, process.stop or process.crash as the last line. |
|
Package logging writes the JSON line of contract.md section 2 through log/slog: output selection by environment, level, dated files with retention and a size cap, the 64 KiB line limit, text rendering on stderr, and per-work attributes read from the context.
|
Package logging writes the JSON line of contract.md section 2 through log/slog: output selection by environment, level, dated files with retention and a size cap, the 64 KiB line limit, text rendering on stderr, and per-work attributes read from the context. |
|
Package metrics turns the OTel metric SDK on when OTEL_EXPORTER_OTLP_ENDPOINT is set and leaves it a no-op otherwise.
|
Package metrics turns the OTel metric SDK on when OTEL_EXPORTER_OTLP_ENDPOINT is set and leaves it a no-op otherwise. |
|
Package paths resolves the six per-app directories of contract.md section 9.3 on Linux and macOS.
|
Package paths resolves the six per-app directories of contract.md section 9.3 on Linux and macOS. |
|
Package secrets keeps an app's secrets (contract.md section 9.5): API tokens and anything else that may not sit in plain text.
|
Package secrets keeps an app's secrets (contract.md section 9.5): API tokens and anything else that may not sit in plain text. |
|
Package socket gives a daemon its Unix socket and a client its connection to it.
|
Package socket gives a daemon its Unix socket and a client its connection to it. |
|
Package tracing turns the OTel trace SDK on when OTEL_EXPORTER_OTLP_ENDPOINT is set and leaves it a no-op otherwise.
|
Package tracing turns the OTel trace SDK on when OTEL_EXPORTER_OTLP_ENDPOINT is set and leaves it a no-op otherwise. |
|
Package work is the unit of work of contract.md section 4: one wide event per CLI command run (command.run) and per handled request (request.handled, from the HTTP middleware or from Request for a socket or RPC server), a span that continues the caller's trace, attributes gathered while the unit runs, TRACEPARENT for child processes and job.progress for long jobs.
|
Package work is the unit of work of contract.md section 4: one wide event per CLI command run (command.run) and per handled request (request.handled, from the HTTP middleware or from Request for a socket or RPC server), a span that continues the caller's trace, attributes gathered while the unit runs, TRACEPARENT for child processes and job.progress for long jobs. |
Click to show internal directories.
Click to hide internal directories.