mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-12 03:06:41 +08:00
update 12.2.md (#510)
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
@@ -28,7 +29,7 @@ func main() {
|
||||
inputReader := bufio.NewReader(inputFile)
|
||||
for {
|
||||
inputString, readerError := inputReader.ReadString('\n')
|
||||
fmt.Printf("The input was: %s", inputString)
|
||||
fmt.Printf("The input was: %s", inputString)
|
||||
if readerError == io.EOF {
|
||||
return
|
||||
}
|
||||
@@ -71,7 +72,7 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "File Error: %s\n", err)
|
||||
// panic(err.Error())
|
||||
}
|
||||
}
|
||||
fmt.Printf("%s\n", string(buf))
|
||||
err = ioutil.WriteFile(outputFile, buf, 0644) // oct, not hex
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user