Remove use of io/ioutil

This commit is contained in:
Matthew Holt 2022-09-30 11:26:26 -06:00
parent e09becb9d1
commit 2b5d89d9e5
No known key found for this signature in database
GPG key ID: 2A349DD577D586A5
3 changed files with 3 additions and 5 deletions

View file

@ -1,6 +1,6 @@
linters-settings:
errcheck:
ignore: fmt:.*,io/ioutil:^Read.*
ignore: fmt:.*:^Read.*
ignoretests: true
misspell:
locale: US

View file

@ -17,7 +17,6 @@ package xcaddy
import (
"context"
"fmt"
"io/ioutil"
"log"
"os"
"path"
@ -227,7 +226,7 @@ func newTempFolder() (string, error) {
}
}
ts := time.Now().Format(yearMonthDayHourMin)
return ioutil.TempDir(parentDir, fmt.Sprintf("buildenv_%s.", ts))
return os.MkdirTemp(parentDir, fmt.Sprintf("buildenv_%s.", ts))
}
// versionedModulePath helps enforce Go Module's Semantic Import Versioning (SIV) by

View file

@ -18,7 +18,6 @@ import (
"bytes"
"context"
"fmt"
"io/ioutil"
"log"
"os"
"os/exec"
@ -87,7 +86,7 @@ func (b Builder) newEnvironment(ctx context.Context) (*environment, error) {
// write the main module file to temporary folder
mainPath := filepath.Join(tempFolder, "main.go")
log.Printf("[INFO] Writing main module: %s\n%s", mainPath, buf.Bytes())
err = ioutil.WriteFile(mainPath, buf.Bytes(), 0644)
err = os.WriteFile(mainPath, buf.Bytes(), 0644)
if err != nil {
return nil, err
}