()
| 17 | } |
| 18 | |
| 19 | func detectWords() int { |
| 20 | msgs := getWords() |
| 21 | var numWordsDetected int |
| 22 | for _, word := range msgs { |
| 23 | // this condition returns words like whale, whaling, whales |
| 24 | if strings.Contains(word, "whal") { |
| 25 | numWordsDetected++ |
| 26 | // golang is too powerful, so we have to slow it down to run pprof |
| 27 | time.Sleep(50 * time.Millisecond) |
| 28 | } |
| 29 | } |
| 30 | return numWordsDetected |
| 31 | |
| 32 | } |
| 33 | |
| 34 | func main() { |
| 35 | // run pprof |