(row string)
| 104 | } |
| 105 | |
| 106 | func splitColumns(row string) []string { |
| 107 | s := strings.TrimSpace(row) |
| 108 | // uses 3 spaces between columns |
| 109 | result := regexp.MustCompile(`\s{3,}`).Split(s, -1) |
| 110 | |
| 111 | if regexp.MustCompile(`\s{31}`).MatchString(s) { |
| 112 | |
| 113 | if len(result) == 8 { |
| 114 | // Both cpu entitlement and details are empty |
| 115 | result = append(result[:len(result)-1], "", "", result[len(result)-1]) |
| 116 | } else { |
| 117 | // Only details is empty |
| 118 | result = append(result[:len(result)-2], result[len(result)-2], "", result[len(result)-1]) |
| 119 | } |
| 120 | |
| 121 | } else if regexp.MustCompile(`\s{21}`).MatchString(s) { |
| 122 | // cpu entitlement is empty, details is filled |
| 123 | result = append(result[:len(result)-2], "", result[len(result)-2], result[len(result)-1]) |
| 124 | } |
| 125 | return result |
| 126 | } |
no outgoing calls
no test coverage detected