title: Create new object of typed value via Go (go 1.18) generics
body: <p>I am playing with generics in beta release of go 1.18. Create function in example below should create new instance of <code>*T</code> (therefore <code>*Apple</code>). I tried to use reflect package for that, but without luck.</p>
  <p>Can you please show me how I can change function <code>Create</code> from the example below so that it creates instance of <code>T</code> instead of returning nil and crashing my example?</p>
  <pre><code>type FruitFactory[T any] struct{}
  
  func (f FruitFactory[T]) Create() *T {
      //how to create non-nil fruit here?
      return nil
  }
  
  type Apple struct {
      color string
  }
  
  func example() {
      appleFactory := FruitFactory[Apple]{}
      apple := appleFactory.Create()
      //panics because nil pointer access
      apple.color = &quot;red&quot;
  }
  </code></pre>