io/ioutil deprecated (#3217)

This commit is contained in:
guangwu
2023-05-06 17:50:54 +08:00
committed by GitHub
parent 4f13fe8188
commit 63368d8b0c
27 changed files with 85 additions and 89 deletions

View File

@@ -2,7 +2,7 @@ package quickstart
import (
_ "embed"
"io/ioutil"
"os"
"path/filepath"
"github.com/zeromicro/go-zero/core/logx"
@@ -35,7 +35,7 @@ func initAPIFlags() error {
apiFilename := filepath.Join(apiWorkDir, "greet.api")
apiBytes := []byte(apiContent)
if err := ioutil.WriteFile(apiFilename, apiBytes, 0o666); err != nil {
if err := os.WriteFile(apiFilename, apiBytes, 0o666); err != nil {
return err
}
@@ -59,7 +59,7 @@ func (m mono) createAPIProject() {
log.Debug(">> Generating quickstart api project...")
logx.Must(gogen.GoCommand(nil, nil))
etcFile := filepath.Join(apiWorkDir, "etc", "greet.yaml")
logx.Must(ioutil.WriteFile(etcFile, []byte(apiEtcContent), 0o666))
logx.Must(os.WriteFile(etcFile, []byte(apiEtcContent), 0o666))
logicFile := filepath.Join(apiWorkDir, "internal", "logic", "pinglogic.go")
svcFile := filepath.Join(apiWorkDir, "internal", "svc", "servicecontext.go")
configPath := filepath.Join(apiWorkDir, "internal", "config")