Update 12.6.md (#785)

我觉得true 并没有什么用 谁可以解释一下
This commit is contained in:
romantic艾克
2021-03-02 01:27:07 +08:00
committed by GitHub
parent bcd3310458
commit 1fd5e57c6a

View File

@@ -7,7 +7,7 @@ func cat(f *os.File) {
const NBUF = 512 const NBUF = 512
var buf [NBUF]byte var buf [NBUF]byte
for { for {
switch nr, err := f.Read(buf[:]); true { switch nr, err := f.Read(buf[:]); {
case nr < 0: case nr < 0:
fmt.Fprintf(os.Stderr, "cat: error reading: %s\n", err.Error()) fmt.Fprintf(os.Stderr, "cat: error reading: %s\n", err.Error())
os.Exit(1) os.Exit(1)