Commit Graph

15 Commits

Author SHA1 Message Date
Vincent Bernat
e2f1df9add tests: replace godebug by go-cmp for structure diffs
go-cmp is stricter and allow to catch more problems. Moreover, the
output is a bit nicer.
2025-08-23 16:03:09 +02:00
Vincent Bernat
18beb310ee chore: replace interface{} with any 2025-07-29 07:42:49 +02:00
Vincent Bernat
76151bea66 common/helpers: make some mapstructure hooks work with embedded structs
When using `mapstructure:",squash"`, most structure-specific hook don't
dive into the structure as they are provided with the parent structure.
Add an helper to make them work on the embedded structure as well and
use it for the generic "deprecated fields" hook, but also for the hook
for the common Kafka configuration.

This is a bit brittle. There are other use cases, but they may not need
this change.
2025-07-27 21:44:28 +02:00
Vincent Bernat
5a9a6e6f0a common/helpers: add a hook to deprecate some fields
And apply it to SystemLogTTL and PrometheusEndpoint. It would be nice to
log a warning, but we don't have access to a logger here.
2025-07-27 21:44:28 +02:00
Vincent Bernat
1c42211219 common/helpers: fix mapstructure tests 2025-06-19 06:57:37 +02:00
Vincent Bernat
e1672c7f32 common/helpers: fix decoding of strings as slice
We use the previous version of the function from upstream.
2025-02-15 14:51:17 +01:00
Vincent Bernat
e08331a286 common/helpers: switch to a blessed fork of mapstructure 2025-02-15 14:51:17 +01:00
Vincent Bernat
c948b9779e common/helper: add a helper to rename a configuration setting 2024-08-21 19:19:38 +02:00
Vincent Bernat
de65ee6072 tests: introduce helpers.Pos/helpers.Mark
This helps locating the position of a test.
2024-07-01 07:42:36 +02:00
Vincent Bernat
b3a9f6ab2e chore: remove unused parameters
They were not detected by revive in function literals.
2024-02-08 08:30:33 +01:00
Vincent Bernat
4069ecd158 common/helpers: add an helper to set default values for inner structs 2023-04-23 13:16:44 +02:00
Vincent Bernat
a912da7fa1 build: use gofumpt
Undecided if we need to use it. I think it's nice.
2023-02-11 10:03:45 +01:00
Vincent Bernat
f1f83a2ba8 common/helpers: move parametrized configuration to helpers package 2022-12-21 16:34:22 +01:00
Vincent Bernat
c3d2fc64f8 helpers/mapstructure: turn panic while decoding to an error message
While there is more helpful information in a panic, this is confusing
to the user. With the amount of code using reflection, it seems better
to have clearer messages to help the user find the faulty section if
any.
2022-08-30 20:32:45 +02:00
Vincent Bernat
8ee2750012 inlet/geoip: rename country-database to geo-database
This is a first step to accept another kind of GeoIP database (like
City). This also introduces the way we want to deprecate stuff:
transform the map structure.
2022-07-29 15:55:39 +02:00