mirror of
https://github.com/caddyserver/xcaddy.git
synced 2025-02-02 06:07:24 +01:00
Remove use of io/ioutil
This commit is contained in:
parent
e09becb9d1
commit
2b5d89d9e5
3 changed files with 3 additions and 5 deletions
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue