You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This seems because nil in expression is parsed as identifier, not literal. I guess true and false have the same issue. golint and go vet does not complain this.
What did you expect to see?
I expected not to see oops in output
What did you see instead?
I saw oops in output
The text was updated successfully, but these errors were encountered:
nil is a predeclared identifier, not a keyword: https://golang.org/ref/spec#Predeclared_identifiers. This was an intentional decision; I don’t anticipate it changing. Going to close this as working as intended. Feel free to ask to re-open if I’ve misunderstood. If you want to discuss the design, I suggest the golang-nuts mailing list. Thanks for taking the time to file an issue.
Uh oh!
There was an error while loading. Please reload this page.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I found
nil
literal is actuallynil
identifier in Go. So it can be replaced by declaringnil
in outer scope.https://play.golang.org/p/itEzumDVEGF
This seems because
nil
in expression is parsed as identifier, not literal. I guesstrue
andfalse
have the same issue.golint
andgo vet
does not complain this.What did you expect to see?
I expected not to see
oops
in outputWhat did you see instead?
I saw
oops
in outputThe text was updated successfully, but these errors were encountered: