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: linters-settings:
errcheck: errcheck:
ignore: fmt:.*,io/ioutil:^Read.* ignore: fmt:.*:^Read.*
ignoretests: true ignoretests: true
misspell: misspell:
locale: US locale: US

View file

@ -17,7 +17,6 @@ package xcaddy
import ( import (
"context" "context"
"fmt" "fmt"
"io/ioutil"
"log" "log"
"os" "os"
"path" "path"
@ -227,7 +226,7 @@ func newTempFolder() (string, error) {
} }
} }
ts := time.Now().Format(yearMonthDayHourMin) 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 // versionedModulePath helps enforce Go Module's Semantic Import Versioning (SIV) by

View file

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