Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Abnormal behaviour when passing &os.FileInfo to goroutine #41353
What version of Go are you using:
What operating system and processor architecture are you using?
What did you do?:
I am processing a slice of os.FileInfo by passing each by pointer ref to a goroutine.
Full program to reproduce the error. Two or more zip files should be in the current dir. File type doesn't matter...replace the last parameter of findFilesByExt if you're not using zip files.
What did you expect to see?
What did you see instead?
Thank you for raising this issue. This is not a bug in Go or the os package, what is occurning is on each iteration of the range loop the variable
Here is a shorter example that shows the issue
As a bonus, both this smaller example and your original code contain a data race. See https://blog.golang.org/race-detector .
I'm going to close this issue as, while suprising, not a bug. Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.
For asking questions, see: