I keep the last error count per device in counts := map[string]int{}. Looking up a device that was never added, counts["pump-7"], returns 0 with no error, which is indistinguishable from a device that really has zero errors. In another place I declared var limits map[string]int, and the first assignment limits["pump-7"] = 5 crashed with "panic: assignment to entry in nil map", although reading from it had worked.
How do I test whether a key exists, and why can I read from the second map but not write to it?




