Original post

Description pretty much says it all. I have replicated the behaviour with this simple code snippet:

func main() {
        files, _ := os.Open("hosts.txt")
        defer files.Close()
        scanner := bufio.NewScanner(files)
        scanner.Split(bufio.ScanLines)
        for {
                for scanner.Scan() {
                        fmt.Printf("Host: %sn", scanner.Text())
                }
                time.Sleep(3 * time.Second)
        }
}

Code will run, but will never run second, third and so on times, and I don’t understand what is wrong flow-wise. Am I using bufio.Scan() wrong?