Skip to content
New issue

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

x/build: Fourth nested variable not detected #45324

Closed
mokiat opened this issue Apr 1, 2021 · 2 comments
Closed

x/build: Fourth nested variable not detected #45324

mokiat opened this issue Apr 1, 2021 · 2 comments
Labels
Milestone

Comments

@mokiat
Copy link

@mokiat mokiat commented Apr 1, 2021

What version of Go are you using (go version)?

$ go version

go version go1.16.2 darwin/amd64

Does this issue reproduce with the latest release?

Yes, it reproduces in Go Playground as well.

What operating system and processor architecture are you using (go env)?

MacOS, 64 bit but this reproduces on Linux and Go Playground as well.

What did you do?

I have a program that has the same variable name nested four times and it seems that Go does not consider the last one for some reason. I am not sure if maybe this is just a bug with some type of compiler validation or linter.

You can see the behavior here:
https://play.golang.org/p/zNmdyH3Owl_W

What did you expect to see?

Global count: 1
Main count: 65
Nested count: 80
Nested-nested count: 82

What did you see instead?

./prog.go:29:5: сount declared but not used
@gopherbot gopherbot added this to the Unreleased milestone Apr 1, 2021
@ZekeLu
Copy link

@ZekeLu ZekeLu commented Apr 1, 2021

				сount = 82

The first character here is not c:

# the character copied from your code
$ echo -n "с" | xxd
00000000: d181                                     ..
# the character typed manually
$ echo -n "c" | xxd
00000000: 63                                       c
@mokiat
Copy link
Author

@mokiat mokiat commented Apr 1, 2021

Happy 1st of April!

I hope I didn't waste too much of your time. Have a nice day!

@mokiat mokiat closed this Apr 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants