1
0
mirror of https://github.com/mgechev/revive.git synced 2025-10-30 23:37:49 +02:00

chore: improve time-date decimal tests (#1378)

We want to ensure that the decimal literal are also detected in
functions, and not just at the package level.

This is a safeguard against future changes.
This commit is contained in:
ccoVeille
2025-05-26 09:54:33 +02:00
committed by GitHub
parent a4737e935a
commit ab05438914

View File

@@ -71,6 +71,15 @@ var (
time.UTC)
)
// here we are checking that we also detect non-decimal notation in methods/functions/lambdas
func _() {
_ = time.Date(2023, 01, 2, 3, 4, 5, 6, time.UTC) // MATCH /use decimal digits for time.Date month argument: octal notation with leading zero found: use 1 instead of 01/
_ = func() time.Time {
return time.Date(2023, 01, 2, 3, 4, 5, 6, time.UTC) // MATCH /use decimal digits for time.Date month argument: octal notation with leading zero found: use 1 instead of 01/
}
}
// these should never match
var (
_ = time.Date(2023, 1, 2, 3, 4, 5, 1234567, time.UTC)