mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-12 05:11:49 +08:00
update book code
This commit is contained in:
23
eBook/examples/chapter_11/static.go
Normal file
23
eBook/examples/chapter_11/static.go
Normal file
@@ -0,0 +1,23 @@
|
||||
// static.go
|
||||
package main
|
||||
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
"bufio"
|
||||
"bytes"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
var r io.Reader
|
||||
|
||||
func main() {
|
||||
r = os.Stdin
|
||||
r = bufio.NewReader(r)
|
||||
r = new(bytes.Buffer)
|
||||
f, _ := os.Open("test.txt")
|
||||
r = bufio.NewReader(f)
|
||||
var s *bytes.Buffer = new(bytes.Buffer)
|
||||
r = s
|
||||
fmt.Println(s)
|
||||
}
|
Reference in New Issue
Block a user