code: func (enc *Encoder) encodeStruct(v reflect.Value) (int, error) {
  	var n int
  	vt := v.Type()
  	for i := 0; i < v.NumField(); i++ {
  		// Skip unexported fields and indirect through pointers.
  		vtf := vt.Field(i)
  		if vtf.PkgPath != "" {
  			continue
  		}
  		vf := v.Field(i)
  		vf = enc.indirect(vf)
  
  		// Handle non-opaque data to []uint8 and [#]uint8 based on struct tag.
  		tag := vtf.Tag.Get("xdropaque")
  		if tag == "false" {
  			switch vf.Kind() {
  			case reflect.Slice:
  				n2, err := enc.encodeArray(vf, true)
  				n += n2
  				if err != nil {
  					return n, err
  				}
  				continue
  
  			case reflect.Array:
  				n2, err := enc.encodeFixedArray(vf, true)
  				n += n2
  				if err != nil {
  					return n, err
  				}
  				continue
  			}
  		}
  
  		// Encode each struct field.
  		n2, err := enc.encode(vf)
  		n += n2
  		if err != nil {
  			return n, err
  		}
  	}
  
  	return n, nil
  }
docs: // encodeStruct writes an XDR encoded representation of each value in the
  // exported fields of the struct represented by the passed reflection value to
  // the encapsulated writer and returns the number of bytes written.  Pointers
  // are automatically indirected through arbitrary depth to encode the actual
  // value pointed to.
  //
  // A MarshalError is returned if any issues are encountered while encoding
  // the elements.
  //
  // Reference:
  // 	RFC Section 4.14 - Structure
  // 	XDR encoded elements in the order of their declaration in the struct