(out string)
| 164 | } |
| 165 | |
| 166 | func parseWindowsEventText(out string) []windowsEvent { |
| 167 | var blocks []string |
| 168 | var current []string |
| 169 | for _, line := range strings.Split(out, "\n") { |
| 170 | line = strings.TrimRight(line, "\r") |
| 171 | if strings.HasPrefix(line, "Event[") && strings.HasSuffix(line, "]:") { |
| 172 | if len(current) > 0 { |
| 173 | blocks = append(blocks, strings.TrimSpace(strings.Join(current, "\n"))) |
| 174 | } |
| 175 | current = []string{line} |
| 176 | continue |
| 177 | } |
| 178 | if len(current) > 0 { |
| 179 | current = append(current, line) |
| 180 | } |
| 181 | } |
| 182 | if len(current) > 0 { |
| 183 | blocks = append(blocks, strings.TrimSpace(strings.Join(current, "\n"))) |
| 184 | } |
| 185 | |
| 186 | events := make([]windowsEvent, 0, len(blocks)) |
| 187 | for _, block := range blocks { |
| 188 | e := windowsEvent{Text: block} |
| 189 | for _, line := range strings.Split(block, "\n") { |
| 190 | line = strings.TrimSpace(line) |
| 191 | if !strings.HasPrefix(line, "Event Record ID:") { |
| 192 | continue |
| 193 | } |
| 194 | id, err := strconv.ParseUint(strings.TrimSpace(strings.TrimPrefix(line, "Event Record ID:")), 10, 64) |
| 195 | if err == nil { |
| 196 | e.RecordID = id |
| 197 | } |
| 198 | break |
| 199 | } |
| 200 | events = append(events, e) |
| 201 | } |
| 202 | return events |
| 203 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…