title: Golang using lowercase for first letter in Struct property
body: <p>I have an issue with Golang view template, I currently using lowercase in the struct properties to build the struct then passed it to the view as a map.</p>
  
  <p>here is my Struct look like:</p>
  
  <pre><code>type User struct {
        uid                  int
        username, departname string
  }
  </code></pre>
  
  <p>then I passed the collection of structs to the file view:</p>
  
  <pre><code>func (App *App) indexHander(w http.ResponseWriter, r *http.Request) {
        rows, err := App.db.Query("SELECT * FROM userinfo")
        checkErr(err)
  
        t, _ := template.ParseFiles(App.folderpath + "/list.gtpl")
  
        users := make([]User, 0) // define empty collection of users
  
        for rows.Next() {
            var uid int 
            var username string
            var departname string
            var created string
            err = rows.Scan(&amp;uid, &amp;username, &amp;departname, &amp;created)
            checkErr(err)
            users = append(users, User{uid, username, departname})
  
        }   
  
        t.Execute(w, users)
  
        defer rows.Close()
    }
  </code></pre>
  
  <p><strong>and here is my view html code:</strong></p>
  
  <pre><code>&lt;html&gt;
        &lt;head&gt;
        &lt;title&gt;&lt;/title&gt;
        &lt;/head&gt;
        &lt;body&gt;
            &lt;ul&gt;
            {{ range  . }}
               &lt;li&gt;{{ .username }}&lt;/li&gt;
            {{ end }}
            &lt;/ul&gt;
        &lt;/body&gt;
    &lt;/html&gt;
  </code></pre>
  
  <p>Those code above gave me empty users data:
  <a href="https://i.stack.imgur.com/omsqR.png" rel="noreferrer"><img src="https://i.stack.imgur.com/omsqR.png" alt="enter image description here"></a></p>
  
  <p>But however, using capitalize first letter in struct give me working result:</p>
  
  <p><strong>Struct</strong></p>
  
  <pre><code>type User struct {
       Uid                  int
       Username, Departname string  
  }
  </code></pre>
  
  <p><strong>html</strong></p>
  
  <pre><code>&lt;html&gt;
        &lt;head&gt;
        &lt;title&gt;&lt;/title&gt;
        &lt;/head&gt;
        &lt;body&gt;
            &lt;ul&gt;
            {{ range  . }}
               &lt;li&gt;{{ .Username }}&lt;/li&gt;
            {{ end }}
            &lt;/ul&gt;
        &lt;/body&gt;
    &lt;/html&gt;
  </code></pre>
  
  <p><strong>it works now</strong></p>
  
  <p><a href="https://i.stack.imgur.com/uJLzS.png" rel="noreferrer"><img src="https://i.stack.imgur.com/uJLzS.png" alt="enter image description here"></a></p>
  
  <p>Can somebody explain me this behavior ?</p>