title: Golang: How to skip struct fields while reading from a buffer?
body: <p><a href="http://play.golang.org/p/RQXB-hCq_M" rel="nofollow">http://play.golang.org/p/RQXB-hCq_M</a></p>
  
  <pre><code>type Header struct {
      ByteField1 uint32    // 4 bytes
      ByteField2 [32]uint8 // 32 bytes
      ByteField3 [32]uint8 // 32 bytes
      SkipField1 []SomethingElse
  }
  
  func main() {
      var header Header
      headerBytes := make([]byte, 68)  // 4 + 32 + 32 == 68
      headerBuf := bytes.NewBuffer(headerBytes)
      err := binary.Read(headerBuf, binary.LittleEndian, &amp;header)
      if err != nil {
          fmt.Println(err)
      }
      fmt.Println(header)
  }
  </code></pre>
  
  <p>I don't want to read from the buffer into the header struct in chunks. I want to read into the bytefield in one step but skip non byte fields. If you run the program in the given link (<a href="http://play.golang.org/p/RQXB-hCq_M" rel="nofollow">http://play.golang.org/p/RQXB-hCq_M</a>) you will find that binary.Read to throw an error: binary.Read: invalid type []main.SomethingElse</p>
  
  <p>Is there a way that I can skip this field?</p>
  
  <p>Update:
  Based on dommage's answer, I decided to embed the fields inside the struct instead like this
  <a href="http://play.golang.org/p/i0xfmnPx4A" rel="nofollow">http://play.golang.org/p/i0xfmnPx4A</a></p>