I am debugging an issue that randomly makes the code below to hit io.EOF instead of reporting first byte 'u' from "ugh":
$ echo "ugh" | eraseme ;# this randomly reports EOF instead of first byte 'u' from "ugh" $ more eraseme/main.go // (snip) func main() { input := bufio.NewReader(os.Stdin) b, err := input.ReadByte() log.Printf("byte='%c' error=%v", b, err) if err != nil { os.Exit(1) } } I suspect the offending code is a variable initialization from an imported package: var Result = newResult() // in imported package I can suppress the race by not importing that package or by turning newResult() into a no-op function. However, all newResult() does it to allocate/initialize variables and log.Printf() messages. I fail to see how newResult() could directly affect reading from os.Stdin. Question: Can anyone figure out how initialization timing (?) would insert io.EOF in the stream created by bufio.NewReader(os.Stdin) ? System is: go version go1.12 linux/amd64 The code does NOT launch any goroutine. Thanks, Everton -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.