package main
import (
"fmt"
"time"
)
type unique struct {
id, nonce uint64
}
func (unique *unique) print() {
fmt.Println(unique.id)
}
func main() {
teste := []unique{unique{1, 2}, unique{3, 4}, unique{5, 6}}
for _, valor := range teste {
valorTmp := valor;
go valorTmp.print()
}
}
//https://pt.stackoverflow.com/q/215263/101
cGFja2FnZSBtYWluCgppbXBvcnQgKAoJImZtdCIKCSJ0aW1lIgopCgp0eXBlIHVuaXF1ZSBzdHJ1Y3QgewogICAgaWQsIG5vbmNlIHVpbnQ2NAp9CgpmdW5jICh1bmlxdWUgKnVuaXF1ZSkgcHJpbnQoKSB7CiAgICBmbXQuUHJpbnRsbih1bmlxdWUuaWQpCn0KCmZ1bmMgbWFpbigpIHsKICAgIHRlc3RlIDo9IFtddW5pcXVle3VuaXF1ZXsxLCAyfSwgdW5pcXVlezMsIDR9LCB1bmlxdWV7NSwgNn19CiAgICBmb3IgXywgdmFsb3IgOj0gcmFuZ2UgdGVzdGUgewogICAgICAgIHZhbG9yVG1wIDo9IHZhbG9yOwogICAgICAgIGdvIHZhbG9yVG1wLnByaW50KCkKICAgIH0KICAgIHRpbWUuU2xlZXAoNCAqIHRpbWUuU2Vjb25kKQp9CgovL2h0dHBzOi8vcHQuc3RhY2tvdmVyZmxvdy5jb20vcS8yMTUyNjMvMTAx