* Return the cached value if it's not time to scan again yet
This should ensure that if we have a valid value cached (which ought
to be every time after the first scan), we return it as metrics.
This fixes the crashes that would happen if queries happened earlier
than the re-scan interval allowed.
* Address review feedback: Shorten the time-to-scan logic
We can express this in a single if statement, so it takes fewer lines
to do the "should we check again" check.
Use standard Prometheus Community build infra.
* Update Go modules for new location
* Update references to github URLs
* Update for Go 1.17+
Signed-off-by: SuperQ <superq@gmail.com>
The previous code was parsing left-to-right, but the bits are actually
numbered right-to-left (least to most significant). Instead of
converting to strings, just use bitmasks.
Fixes https://github.com/prometheus-community/smartctl_exporter/issues/22
Signed-off-by: Eric Culp <eculperic@gmail.com>