Replace most usages of ioutil with the underlying function

The ioutil functions are deprecated since Go 1.17 and only wrap another
library function. Thus directly call the underlying function.

This commit only mechanically replaces the function calls.
This commit is contained in:
Michael Eischer committed 2022-12-02 19:36:43 +01:00
1 parent 2d5e28e777
commit ff7ef5007e
57 files changed
+119 -159

No files matched your search

+2 -3
View File
@@ -2,7 +2,6 @@ package cache
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"regexp"
@@ -26,7 +25,7 @@ const dirMode = 0700
const fileMode = 0644
func readVersion(dir string) (v uint, err error) {
buf, err := ioutil.ReadFile(filepath.Join(dir, "version"))
buf, err := os.ReadFile(filepath.Join(dir, "version"))
if errors.Is(err, os.ErrNotExist) {
return 0, nil
}
@@ -130,7 +129,7 @@ func New(id string, basedir string) (c *Cache, err error) {
}
if v < cacheVersion {
err = ioutil.WriteFile(filepath.Join(cachedir, "version"), []byte(fmt.Sprintf("%d", cacheVersion)), fileMode)
err = os.WriteFile(filepath.Join(cachedir, "version"), []byte(fmt.Sprintf("%d", cacheVersion)), fileMode)
if err != nil {
return nil, errors.WithStack(err)
}