jaypipes / ghw

Go HardWare discovery/inspection library
Apache License 2.0
1.64k stars 180 forks source link

util: add helper to avoid long format strings #299

Closed ffromani closed 2 years ago

ffromani commented 2 years ago

A relatively common pattern in the ghw codebase is concatenating quite a lot of strings inside a format string. This leads to a pattern like '%s%s%s%s%s' which are hard to read and to debug.

Ad a simple helper to concatenate strings to simplify the format strings.

This may be the definitive solution here, but it should improve the maintenability and readability, and it's very cheap to implement and maintain.

Signed-off-by: Francesco Romani fromani@redhat.com