MCPcopy
hub / github.com/slimtoolkit/slim / findEvent

Function findEvent

pkg/app/sensor/standalone/control/wait.go:43–64  ·  view source on GitHub ↗
(eventsFile string, target event.Type)

Source from the content-addressed store, hash-verified

41}
42
43func findEvent(eventsFile string, target event.Type) (bool, error) {
44 file, err := os.Open(eventsFile)
45 if err != nil {
46 return false, err
47 }
48 defer file.Close()
49
50 scanner := bufio.NewScanner(file)
51 for scanner.Scan() {
52 line := scanner.Text()
53 // A bit hacky - we probably need to parse the event struct properly.
54 if strings.Contains(line, string(target)) {
55 return true, nil
56 }
57 }
58
59 if scanner.Err() != nil {
60 return false, scanner.Err()
61 }
62
63 return false, nil
64}

Callers 1

waitForEventFunction · 0.85

Calls 1

CloseMethod · 0.65

Tested by

no test coverage detected