【发布时间】:2022-01-28 03:46:27
【问题描述】:
for {
if resp.StatusCode == 200 {
...
break
} else {
data := fmt.Sprintf("[" + time.Now().Format("15:04:05") +"] " + strconv.Itoa(resp.StatusCode) + string(body) + "\n")
file, err := os.Open("assets/errors.txt")
if err != nil {
fmt.Println(err)
}
write := bufio.NewWriter(file)
write.WriteString(data)
write.Flush()
}
【问题讨论】:
for { ... }os.OpenWriteString
标签: go