go-hello-world/hello.go

27 lines
601 B
Go
Raw Normal View History

package main
2021-05-22 21:16:08 -04:00
import ( "fmt"
"time"
2021-05-22 21:19:45 -04:00
"runtime"
2021-05-22 21:37:01 -04:00
"bufio"
2021-05-22 21:39:54 -04:00
"os"
2021-05-22 21:16:08 -04:00
)
func main(){
2021-05-22 21:16:08 -04:00
duration := time.Second
2021-05-22 21:37:01 -04:00
durMin := time.Minute
2021-05-22 21:17:29 -04:00
fmt.Println("Hello World! 0")
2021-05-22 21:16:08 -04:00
time.Sleep(duration)
2021-05-22 21:17:29 -04:00
fmt.Println("Hello World! 1")
time.Sleep(duration)
fmt.Println("Hello World! 2")
2021-05-22 21:19:45 -04:00
time.Sleep(duration)
fmt.Printf("Hello from: %s %s\n",runtime.GOOS,runtime.GOARCH)
2021-05-22 21:37:01 -04:00
time.Sleep(duration)
scanner := bufio.NewScanner(os.Stdin)
scanner.Scan() // use `for scanner.Scan()` to keep reading
line := scanner.Text()
fmt.Println("captured:",line)
2021-05-22 21:37:49 -04:00
time.Sleep(durMin)
}