go-simpler / sloglint

🪵 Ensure consistent code style when using log/slog
https://go-simpler.org/sloglint
Mozilla Public License 2.0
107 stars 5 forks source link

Enforcing attribute naming by type #59

Open mfridman opened 1 month ago

mfridman commented 1 month ago

What do you think about adding the ability to enforce naming for certain types?

One that comes to mind is enforcing error naming. E.g., if the attribute is an error then it must be named "error" or some user-configurable list like:

error-type-names: ["error", "secondary_error"]
mattdowdell commented 2 weeks ago

In slog, kinds (value types) do not treat errors as a first class citizen. Instead, you have to convert them to strings first. Did you have a potential implementation in mind for this feature?