title: How get pointer of struct's member from interface{}
body: <p>I want to pass struct's pointer to function that expect interface{}. Then get (through reflection) the pointer to the struct's member and then modify it using this pointer. I've read a much of Q&amp;A and tried much of variations, but still I can get it work.</p>
  
  <p>Let's consider example below:</p>
  
  <pre><code>type Robot struct {
      Id int
  }
  f := func(i interface {}) {
      v :=  reflect.ValueOf(i).Elem().FieldByName("Id")
      ptr := v.Addr().Pointer()
      *ptr = 100
      //^ it needs to me for functions expecting the pointer: Scan(&amp;pointerToValue)
  }
  
  robot := &amp;Robot{}
  f(robot)
  println(robot.Id) //I want to get here 100
  </code></pre>
  
  <p>I think the problem in poor understanding what actually do <strong>Addr()</strong> and <strong>Pointer()</strong> methods of reflect package..</p>