替换结构的指针时,GC的行为如何

I'm learning Go and I'm reading examples from libraries. I found that some examples are using:

type MyType struct {
  Code string
  //...
}


func main() {
  myType := &MyType{...}
  //...
  myType = &MyType{...}
}

Basically they are reusing variables. I understand that &MyType{..} returns a pointer, later I can replace that pointer. What happens with the previous pointed memory. Will the GC reclaim that memory or will I waste that memory. Maybe this is a silly question and I'm concerned for nothing but I'm trying to learn Go to build performance APIs :)

The memory will be reclaimed by the garbage collector.

If you want to replace the struct you can do it this way:

func main() {
    myType := &MyType{...}
    //...
    *myType = MyType{...}
}

The difference will probably be negligible though.