← Back to context Comment by neild 9 hours ago 0600 and 0_600 are octal literals: octal_lit = "0" [ "o" | "O" ] [ "_" ] octal_digits . 3 comments neild Reply j-scott 8 hours ago Never mind, I was wrong. Here’s a playground showing how go parses each one: https://go.dev/play/p/hyWPkL_9C5W mseepgood 8 hours ago > Octals must start with zero and then o/O literals.No, the o/O is optional (hence in square brackets), only the leading zero is required. All of these are valid octal literals in Go:0600 (zero six zero zero)0_600 (zero underscore six zero zero)0o600 (zero lower-case-letter-o six zero zero)0O600 (zero upper-case-letter-o six zero zero) j-scott 8 hours ago My bad! I was wrong; added a playground demonstration the parsing behavior above.
j-scott 8 hours ago Never mind, I was wrong. Here’s a playground showing how go parses each one: https://go.dev/play/p/hyWPkL_9C5W mseepgood 8 hours ago > Octals must start with zero and then o/O literals.No, the o/O is optional (hence in square brackets), only the leading zero is required. All of these are valid octal literals in Go:0600 (zero six zero zero)0_600 (zero underscore six zero zero)0o600 (zero lower-case-letter-o six zero zero)0O600 (zero upper-case-letter-o six zero zero) j-scott 8 hours ago My bad! I was wrong; added a playground demonstration the parsing behavior above.
mseepgood 8 hours ago > Octals must start with zero and then o/O literals.No, the o/O is optional (hence in square brackets), only the leading zero is required. All of these are valid octal literals in Go:0600 (zero six zero zero)0_600 (zero underscore six zero zero)0o600 (zero lower-case-letter-o six zero zero)0O600 (zero upper-case-letter-o six zero zero) j-scott 8 hours ago My bad! I was wrong; added a playground demonstration the parsing behavior above.
j-scott 8 hours ago My bad! I was wrong; added a playground demonstration the parsing behavior above.
Never mind, I was wrong. Here’s a playground showing how go parses each one: https://go.dev/play/p/hyWPkL_9C5W
> Octals must start with zero and then o/O literals.
No, the o/O is optional (hence in square brackets), only the leading zero is required. All of these are valid octal literals in Go:
0600 (zero six zero zero)
0_600 (zero underscore six zero zero)
0o600 (zero lower-case-letter-o six zero zero)
0O600 (zero upper-case-letter-o six zero zero)
My bad! I was wrong; added a playground demonstration the parsing behavior above.