title: Golang - Get a pointer to a field of a struct through an interface
body: <p>I'm at a very early stage of understanding interfaces in Go. I'm writing some logical simulations and have something like the following code (I heavily simplify here): </p>
  
  <p>Please see the comments for my question:</p>
  
  <pre><code>type LogicNode struct {
      Input   *bool
      Output   *bool
      Operator string
      Next     Node
  }
  
  func (n *LogicNode) Run() {
      // do some stuff here
      n.Next.Run()
  }
  
  type Node interface {
      Run()
  }
  
  func main() {
  
      nodes := make([]Node, 1000)
  
      for i := 0; i &lt; 1000; i++ {
          n := LogicNode{
              //assign values etc.
          }
          nodes[i] = &amp;n
      }
  
      for i, node := range nodes {
          // I need to access LogicNode's Output pointer here, as a *bool.
          // so I can set the same address to other Node's Input thereby "connecting" them.
          // but I could only get something like this:
  
          x := reflect.ValueOf(node).Elem().FieldByName("Output")
  
          // which is &lt;*bool Value&gt;
          // I couldn't find a way to set a new *bool to the underlying (LogicNode) Struct's Input or Output..
      }
  }
  </code></pre>
  
  <p>The reason I'm using interfaces is because there are other node types FloatNode MathNode etc. which have different fields, but they implement their own run method.</p>
  
  <p>I've successfully used Value's SetString or SetBool methods, but can't set a pointer there... Thanks in advance. </p>