title: init of slice in struct
body: <p>I am struggling with the initiation of a slice in a struct (GO-language). This may be easy, but still I can not solve it. I get below error</p>
  <pre><code>./prog.go:11:1: syntax error: unexpected var, expecting field name or embedded type
  ./prog.go:25:2: no new variables on left side of :=
  ./prog.go:26:2: non-name g.s on left side of :=
  </code></pre>
  <p>I believe that <code>s</code> should be declared as part of the struct, so I wonder why I get that error. Someone got some advice?</p>
  <pre class="lang-golang prettyprint-override"><code>package main
  
  import &quot;fmt&quot;
  
  type node struct {
      value int
  }
  
  type graph struct {
      nodes, edges int
      s            []int
  }
  
  func main() {
      g := graphCreate()
  }
  
  func input(tname string) (number int) {
      fmt.Println(&quot;input a number of &quot; + tname)
      fmt.Scan(&amp;number)
      return
  }
  
  func graphCreate() (g graph) {
      g := graph{input(&quot;nodes&quot;), input(&quot;edges&quot;)}
      g.s = make([]int, 100)
      return
  }
  
  </code></pre>