func invalidLayout1(record []string, headerLen, dateField int) ([]string, error) {
	output := make([]string, headerLen, headerLen)

	for j, col := range record {
		if j == dateField+1 {
			if j < 1 {
				spew.Fdump(os.Stderr, record)
				return output, fmt.Errorf("dateField detected to be %d, nFields %d, not possible to index into %d", dateField, headerLen, j)
			} else if j-1 >= headerLen {
				spew.Fdump(os.Stderr, record)
				return output, fmt.Errorf("dateField detected to be %d, nFields %d, not possible to index into %d", dateField, headerLen, j)
			}
			output[j-1] += ", " + strings.TrimSpace(col)
		} else if j > dateField+1 {
			if j < 1 {
				spew.Fdump(os.Stderr, record)
				return output, fmt.Errorf("dateField detected to be %d, nFields %d, not possible to index into %d", dateField, headerLen, j)
			} else if j-1 >= headerLen {
				spew.Fdump(os.Stderr, record)
				return output, fmt.Errorf("dateField detected to be %d, nFields %d, not possible to index into %d", dateField, headerLen, j)
			}
			output[j-1] = strings.TrimSpace(col)
		} else {
			if j < 0 {
				spew.Fdump(os.Stderr, record)
				return output, fmt.Errorf("dateField detected to be %d, nFields %d, not possible to index into %d", dateField, headerLen, j)
			} else if j >= headerLen {
				spew.Fdump(os.Stderr, record)
				return output, fmt.Errorf("dateField detected to be %d, nFields %d, not possible to index into %d", dateField, headerLen, j)
			}
			output[j] = strings.TrimSpace(col)
		}
	}

	return output, nil
}
// invalidLayout1 works for the situation where there are more fields than there
// should be, because there is a comma in the date field.
invalidLayout1 works for the situation where there are more fields than there
should be, because there is a comma in the date field.
// invalidLayout1 works for the situation where there are more fields than there // should be because there is a comma in the date field .
func invalidLayout1(record []string, headerLen, dateField int) ([]string, error) {
	output := make([]string, headerLen, headerLen)
	for j, col := range record {
		if j == dateField+1 {
			if j < 1 {
				spew.Fdump(os.Stderr, record)
				return output, fmt.Errorf("dateField detected to be %d, nFields %d, not possible to index into %d", dateField, headerLen, j)
			} else if j-1 >= headerLen {
				spew.Fdump(os.Stderr, record)
				return output, fmt.Errorf("dateField detected to be %d, nFields %d, not possible to index into %d", dateField, headerLen, j)
			}
			output[j-1] += ", " + strings.TrimSpace(col)
		} else if j > dateField+1 {
			if j < 1 {
				spew.Fdump(os.Stderr, record)
				return output, fmt.Errorf("dateField detected to be %d, nFields %d, not possible to index into %d", dateField, headerLen, j)
			} else if j-1 >= headerLen {
				spew.Fdump(os.Stderr, record)
				return output, fmt.Errorf("dateField detected to be %d, nFields %d, not possible to index into %d", dateField, headerLen, j)
			}
			output[j-1] = strings.TrimSpace(col)
		} else {
			if j < 0 {
				spew.Fdump(os.Stderr, record)
				return output, fmt.Errorf("dateField detected to be %d, nFields %d, not possible to index into %d", dateField, headerLen, j)
			} else if j >= headerLen {
				spew.Fdump(os.Stderr, record)
				return output, fmt.Errorf("dateField detected to be %d, nFields %d, not possible to index into %d", dateField, headerLen, j)
			}
			output[j] = strings.TrimSpace(col)
		}
	}
	return output, nil
}
func invalidLayout1 ( record [ ] string , headerLen , dateField int ) ( [ ] string , error ) { output := make ( [ ] string , headerLen , headerLen ) for j , col := range record { if j == dateField + 1 { if j < 1 { spew . Fdump ( os . Stderr , record ) return output , fmt . Errorf ( " " , dateField , headerLen , j ) } else if j - 1 >= headerLen { spew . Fdump ( os . Stderr , record ) return output , fmt . Errorf ( " " , dateField , headerLen , j ) } output [ j - 1 ] += " " + strings . TrimSpace ( col ) } else if j > dateField + 1 { if j < 1 { spew . Fdump ( os . Stderr , record ) return output , fmt . Errorf ( " " , dateField , headerLen , j ) } else if j - 1 >= headerLen { spew . Fdump ( os . Stderr , record ) return output , fmt . Errorf ( " " , dateField , headerLen , j ) } output [ j - 1 ] = strings . TrimSpace ( col ) } else { if j < 0 { spew . Fdump ( os . Stderr , record ) return output , fmt . Errorf ( " " , dateField , headerLen , j ) } else if j >= headerLen { spew . Fdump ( os . Stderr , record ) return output , fmt . Errorf ( " " , dateField , headerLen , j ) } output [ j ] = strings . TrimSpace ( col ) } } return output , nil }
invalidLayout1 works for the situation where there are more fields than there
should be, because there is a comma in the date field.
invalidLayout1 works for the situation where there are more fields than there should be because there is a comma in the date field .