Skip to content

Commit

Permalink
Remove use of io/ioutil
Browse files Browse the repository at this point in the history
  • Loading branch information
mholt committed Sep 30, 2022
1 parent e09becb commit 2b5d89d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
linters-settings:
errcheck:
ignore: fmt:.*,io/ioutil:^Read.*
ignore: fmt:.*:^Read.*
ignoretests: true
misspell:
locale: US
Expand Down
3 changes: 1 addition & 2 deletions builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ package xcaddy
import (
"context"
"fmt"
"io/ioutil"
"log"
"os"
"path"
Expand Down Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"bytes"
"context"
"fmt"
"io/ioutil"
"log"
"os"
"os/exec"
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 2b5d89d

Please sign in to comment.