Skip to content

Possible to assign to variable named "nil", "true", and others. #12535

@mokiat

Description

@mokiat

Hi,

It is currently possible to assign a value to a variable named nil, as well as other reserved types like float32, int, and others. Considering how explicit Go seems to be regarding code sanity, I am inclined to consider this a bug.

Here is an example:
http://play.golang.org/p/AgUlQ810Yi

I find the one with the overriding of true to be the most interesting case (thanks to @Bo0mer for pointing that one out).

Regards,
Momchil

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions