Vitalts / golangide

Automatically exported from code.google.com/p/golangide
0 stars 0 forks source link

output reversed from example online #43

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. do gotour 31
2.
3.

What is the expected output? What do you see instead?
Bell Labs first, Google second
Google first, Bell Labs second
What version of the product are you using? On what operating system?
x 10 on Vista

Please provide any additional information below.

Original issue reported on code.google.com by StephenF...@gmail.com on 9 Nov 2011 at 2:21

Attachments:

GoogleCodeExporter commented 8 years ago
Iteration order over maps is random - see 
http://blog.golang.org/go-maps-in-action 

doc: "When iterating over a map with a range loop, the iteration order is not 
specified and is not guaranteed to be the same from one iteration to the next"

I'm 99% certain that fmt.Println uses a

for x,y in range map 

to iterate over a maps elements eg see package fmt documentation and code ie 
http://golang.org/src/pkg/fmt/print.go?s=7070:7117#L885

99% certain not a liteide issue. 

(however current Go release 1.12 does seem to output in order)

Original comment by xun...@gmail.com on 2 Dec 2013 at 3:17