docs(v2): add Example_ functions for pkg.go.dev discoverability
What
Adds example_test.go files to 7 v2 packages, each containing Example_* functions.
Why
Example_* functions are rendered as interactive code samples on pkg.go.dev and are the primary discoverability mechanism for Go libraries. Without them, consumers must read godoc comments and READMEs separately. With them, pkg.go.dev shows runnable snippets inline next to each type and function.
Packages covered
| Package | Examples added |
|---|---|
app |
Example, ExampleNewWithConfig, ExampleApp_Register (incl. custom Component impl) |
log |
Example, ExampleNewWithConfig, ExampleWithFields, ExampleError
|
httpserver |
Example, ExampleServer_AddReadinessCheck, ExampleServer_ServeHTTP
|
secret |
Example, ExampleSecret_String, ExampleClient_Get, ExampleNewFileProvider
|
httpclient |
Example, ExampleClient_DoWithRetry, ExampleNewTransport, ExampleDoer, ExampleClient_Post
|
postgres |
Example, ExampleNewWithConfig
|
fields |
Example |
Testing
Examples with deterministic output use // Output: and are verified by go test. Examples involving network I/O (app lifecycle, postgres, tracing) are compiled but not executed per Go spec.