shad-go/lectures/10-io/readall/main.go

21 lines
268 B
Go
Raw Normal View History

2020-04-23 01:40:13 +00:00
package main
import (
"fmt"
2022-04-21 15:13:36 +00:00
"io"
2020-04-23 01:40:13 +00:00
"log"
"strings"
)
func main() {
r := strings.NewReader("Go is a general-purpose language " +
"designed with systems programming in mind.")
2022-04-21 15:13:36 +00:00
b, err := io.ReadAll(r)
2020-04-23 01:40:13 +00:00
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s", b)
}