code: func generateField(ctx *context, w io.Writer, fields []Field, i int) {
  	field := fields[i]
  
  	fieldName := strings.TrimPrefix(field.Name, "_")
  	fieldName = camelCaseName(fieldName)
  
  	// generate length field for strings
  	if field.Type == "string" {
  		fmt.Fprintf(w, "\tXXX_%sLen uint32 `struc:\"sizeof=%s\"`\n", fieldName, fieldName)
  	}
  
  	dataType := convertToGoType(ctx, field.Type)
  	fieldType := dataType
  
  	// check if it is array
  	if field.Length > 0 || field.SizeFrom != "" {
  		if dataType == "uint8" {
  			dataType = "byte"
  		}
  		fieldType = "[]" + dataType
  	}
  	fmt.Fprintf(w, "\t%s %s", fieldName, fieldType)
  
  	if field.Length > 0 {
  		// fixed size array
  		fmt.Fprintf(w, "\t`struc:\"[%d]%s\"`", field.Length, dataType)
  	} else {
  		for _, f := range fields {
  			if f.SizeFrom == field.Name {
  				// variable sized array
  				sizeOfName := camelCaseName(f.Name)
  				fmt.Fprintf(w, "\t`struc:\"sizeof=%s\"`", sizeOfName)
  			}
  		}
  	}
  
  	fmt.Fprintln(w)
  }
docs: // generateField writes generated code for the field into w