package main
import (
"bufio"
"os"
)
func main() {
bw := bufio.NewWriter(os.Stdin)
bw2 := bufio.NewWriter(os.Stdout)
bw.WriteString("Hello, world 1\n")
bw2.WriteString("Hello, world 2\n")
bw.Flush()
bw2.Flush()
}
This code show both string in a local environment. But why does it work differently in different environments?
My local environment OS : macOS 12.6 go : go1.19.2 darwin/amd64 ide : vscode
- on my local machine :
$ go run myworkspace/main/main.go
Hello, world 1
Hello, world 2
- on the playground :
# in the 'Output' section
---
Hello, world 2
Program exited.