Go 语言 读取文件内容的两种方式
_, err = os.Stat(keyfileName)
if err != nil {
return
}
privateKey1, err := os.ReadFile(keyfileName)
if err != nil {
return
}
open, err := os.Open(keyfileName)
if err != nil {
return
}
defer func(open *os.File) {
_ = open.Close()
}(open)
privateKey2, err := io.ReadAll(open)
if err != nil {
return
}