// gofumpt formats legacy non-decimal notation to new one non-decimal notation
// it transforms 01, 02, 03, 04, 05, 06, and 07 to 0o1, 0o2, 0o3, 0o4, 0o5, 0o6, and 0o7
// but here with time.Date it doesn't make sense. This is the main reason why the rule was created.
var(
_=time.Date(2023,0o1,2,3,4,5,6,time.UTC)// MATCH /use decimal digits for time.Date month argument: octal notation found: use 1 instead of 0o1/
_=time.Date(2023,1,0o2,3,4,5,6,time.UTC)// MATCH /use decimal digits for time.Date day argument: octal notation found: use 2 instead of 0o2/
_=time.Date(2023,1,2,0o3,4,5,6,time.UTC)// MATCH /use decimal digits for time.Date hour argument: octal notation found: use 3 instead of 0o3/
_=time.Date(2023,1,2,3,0o4,5,6,time.UTC)// MATCH /use decimal digits for time.Date minute argument: octal notation found: use 4 instead of 0o4/
_=time.Date(2023,1,2,3,4,0o5,6,time.UTC)// MATCH /use decimal digits for time.Date second argument: octal notation found: use 5 instead of 0o5/
_=time.Date(2023,1,2,3,4,5,0o6,time.UTC)// MATCH /use decimal digits for time.Date nanosecond argument: octal notation found: use 6 instead of 0o6/
)
// padding with zeroes can lead to errors
var(
_=time.Date(2023,1,2,3,4,5,00,time.UTC)// MATCH /use decimal digits for time.Date nanosecond argument: octal notation with leading zero found: use 0 instead of 00/
_=time.Date(2023,1,2,3,4,5,01,time.UTC)// MATCH /use decimal digits for time.Date nanosecond argument: octal notation with leading zero found: use 1 instead of 01/
_=time.Date(2023,1,2,3,4,5,00000000,time.UTC)// MATCH /use decimal digits for time.Date nanosecond argument: octal notation with padding zeroes found: use 0 instead of 00000000/
_=time.Date(2023,1,2,3,4,5,00000006,time.UTC)// MATCH /use decimal digits for time.Date nanosecond argument: octal notation with padding zeroes found: use 6 instead of 00000006/
_=time.Date(2023,1,2,3,4,5,00123456,time.UTC)// MATCH /use decimal digits for time.Date nanosecond argument: octal notation with padding zeroes found: choose between 123456 and 42798 (decimal value of 123456 octal value)/
)
// hypothetical examples based on other number notations
// https://go.dev/ref/spec#Integer_literals
// these should match and be reported as invalid usage of time.Date
var(
_=time.Date(
0x7e7,// MATCH /use decimal digits for time.Date year argument: hexadecimal notation found: use 2023 instead of 0x7e7/
0b1,// MATCH /use decimal digits for time.Date month argument: binary notation found: use 1 instead of 0b1/
0x_2,// MATCH /use decimal digits for time.Date day argument: hexadecimal notation found: use 2 instead of 0x_2/
1_3,// MATCH /use decimal digits for time.Date hour argument: alternative notation found: use 13 instead of 1_3/
1e1,// MATCH /use decimal digits for time.Date minute argument: exponential notation found: use 10 instead of 1e1/
0.,// MATCH /use decimal digits for time.Date second argument: float literal found: use 0 instead of 0./
0x1.Fp+6,// MATCH /use decimal digits for time.Date nanosecond argument: float literal found: use 124 instead of 0x1.Fp+6/
// 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{
returntime.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/