Re: [go-nuts] Pointer to the loop variable

2019-09-10 Thread Yamil Bracho
Then turn vo into a Vertex variable, not a pointer var vp Vertex = Vertex{} ... if v.X == 3 { vp = v } …. This time vp will be a copy of v, Maybe you have to give some known values and exceptional case for your domain, I mean, vp Vertex = { -1, -1} or any values your are positive does n

Re: [go-nuts] Pointer to the loop variable

2019-09-10 Thread Tong Sun
On Tuesday, September 10, 2019 at 3:18:47 PM UTC-4, burak serdar wrote: > > On Tue, Sep 10, 2019 at 1:13 PM Tong Sun > > wrote: > > > > I'm experiencing a weird problem with my program and finally nail it > down to what exactly went wrong, so that I can write a minimum program to > duplicate

Re: [go-nuts] Pointer to the loop variable

2019-09-10 Thread burak serdar
On Tue, Sep 10, 2019 at 1:13 PM Tong Sun wrote: > > I'm experiencing a weird problem with my program and finally nail it down to > what exactly went wrong, so that I can write a minimum program to duplicate > it. See the following program: > > package main > > > import ( > "fmt" > ) > > > type

[go-nuts] Pointer to the loop variable

2019-09-10 Thread Tong Sun
I'm experiencing a weird problem with my program and finally nail it down to what exactly went wrong, so that I can write a minimum program to duplicate it. See the following program: package main import ( "fmt" ) type Vertex struct { X int Y int } func main() { vs := []Vertex{ Vertex