We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm often facing the following pattern when using gofumpt
People are using time.Date with leading 0 for days, months, hours, minutes, or seconds …
here is an example
now := time.Date(2001, 02, 03, 04, 05, 06, 07, time.UTC)
A leading 0 is one of the octal notation
So gofumpt suggests fixing it to use the 0o literal octal notation
0o
So it transforms this piece of code into
now := time.Date(2001, 0o2, 0o3, 0o4, 0o5, 0o6, 0o7, time.UTC)
This pattern is very frequent.
https://github.com/search?q=+%22time.Date%2820%22+language%3Ago+%22%2C+02%2C+%22++&type=code&p=1
People should use
now := time.Date(2001, 2, 3, 4, 5, 6, 7, time.UTC)
For records, I found examples of code where I'm sure gofumpt suggestions were applied, and where time.Date is now using the octal notation
https://github.com/search?q=+%22time.Date%2820%22+language%3Ago+%22%2C+0o1%2C+%22++&type=code
https://github.com/search?q=+%22time.Date%2820%22+language%3Ago+%22%2C+0o2%2C+%22++&type=code
https://github.com/search?q=+%22time.Date%2820%22+language%3Ago+%22%2C+0o4%2C+%22++&type=code
So the checker that could be written should look for 00-07 and 0o0-0o7
This would be very similar to https://staticcheck.dev/docs/checks/#SA9002, just in the opposite direction.
Originally posted by @dominikh in mvdan/gofumpt#309 (comment)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I'm often facing the following pattern when using gofumpt
People are using time.Date with leading 0 for days, months, hours, minutes, or seconds …
here is an example
A leading 0 is one of the octal notation
So gofumpt suggests fixing it to use the
0o
literal octal notationSo it transforms this piece of code into
This pattern is very frequent.
https://github.com/search?q=+%22time.Date%2820%22+language%3Ago+%22%2C+02%2C+%22++&type=code&p=1
People should use
For records, I found examples of code where I'm sure gofumpt suggestions were applied, and where time.Date is now using the octal notation
https://github.com/search?q=+%22time.Date%2820%22+language%3Ago+%22%2C+0o1%2C+%22++&type=code
https://github.com/search?q=+%22time.Date%2820%22+language%3Ago+%22%2C+0o2%2C+%22++&type=code
https://github.com/search?q=+%22time.Date%2820%22+language%3Ago+%22%2C+0o4%2C+%22++&type=code
So the checker that could be written should look for 00-07 and 0o0-0o7
Originally posted by @dominikh in mvdan/gofumpt#309 (comment)
The text was updated successfully, but these errors were encountered: