Fixed lint issues and missing documentation

This commit is contained in:
bwilliams committed 2026-10-13 12:21:32 +01:00
1 parent 7fd321df97
commit 6e6dec68c0
34 files changed
+346 -156

No files matched your search

+10 -7
View File
@@ -121,9 +121,11 @@ Using a source called `example` as an illustration:
- Define `JobSearchConfigSourceExample`, embedding `JobSearchConfigSource`
(for `enabled` and `interval`), plus any fields of its own with `cfg` and
optional `default` tags, e.g. ``APIRoot string `cfg:"api_root"` ``.
- Copy the standard `Map`, `Flatten`, `TypeOf`, `ValueOf` and `SetValue`
methods, renaming the receiver type and using the new constant in
`Flatten`.
- Implement the `Section` interface (see `internal/config/section.go`):
copy the `Map`, `Flatten`, `TypeOf`, `ValueOf` and `SetValue` methods
from an existing source, under a
`// ---------- Section methods (see Section) ----------` banner, renaming
the receiver type and using the new constant in `Flatten`.
2. **Register the section:** add
``Example JobSearchConfigSourceExample `cfg:"example"` `` to
`JobSearchConfigSources` in `internal/config/conf_sources.go`. The `cfg` tag
@@ -148,11 +150,12 @@ Using a source called `example` as an illustration:
start("Example", runExample)
}
```
6. **Tests:** add tests for the new config section to
`internal/config/conf_sections_test.go` (add it to
6. **Tests:** `TestSections` checks the new section implements `Section`
and that its keys match its `cfg` tag, with no changes needed. In
`internal/config/conf_sections_test.go`, add the section to
`TestConcreteSourceSections` and update the key count in
`TestSourcesSection`), and for the client and worker, using `httptest`
servers rather than the real service.
`TestSourcesSection`. Test the client and worker using `httptest` servers
rather than the real service.
7. **Docs:** add the source and its keys to the key table in
`internal/config/README.md`.