updated linter and fixed deprecated stuff

This commit is contained in:
mslacken
2022-10-14 17:40:16 +02:00
parent b5d3de621b
commit ab0ee87629
21 changed files with 50 additions and 60 deletions

View File

@@ -2,7 +2,6 @@ package overlay
import (
"bufio"
"io/ioutil"
"os"
"path"
"strings"
@@ -23,7 +22,7 @@ func templateFileInclude(inc string) string {
inc = path.Join(buildconfig.SYSCONFDIR(), "warewulf", inc)
}
wwlog.Debug("Including file into template: %s", inc)
content, err := ioutil.ReadFile(inc)
content, err := os.ReadFile(inc)
if err != nil {
wwlog.Verbose("Could not include file into template: %s", err)
}
@@ -93,7 +92,7 @@ func templateContainerFileInclude(containername string, filepath string) string
return ""
}
content, err := ioutil.ReadFile(path.Join(containerDir, filepath))
content, err := os.ReadFile(path.Join(containerDir, filepath))
if err != nil {
wwlog.Error("Template include failed: %s", err)

View File

@@ -5,7 +5,6 @@ import (
"bytes"
"fmt"
"io/fs"
"io/ioutil"
"os"
"path"
"path/filepath"
@@ -105,10 +104,9 @@ Get all overlays present in warewulf
*/
func FindOverlays() ([]string, error) {
var ret []string
var files []os.FileInfo
dotfilecheck, _ := regexp.Compile(`^\..*`)
files, err := ioutil.ReadDir(OverlaySourceTopDir())
files, err := os.ReadDir(OverlaySourceTopDir())
if err != nil {
return ret, errors.Wrap(err, "could not get list of overlays")
}
@@ -156,7 +154,7 @@ func BuildOverlay(nodeInfo node.NodeInfo, overlayNames []string) error {
wwlog.Debug("Created directory for %s: %s", name, overlayImageDir)
buildDir, err := ioutil.TempDir(os.TempDir(), ".wwctl-overlay-")
buildDir, err := os.MkdirTemp(os.TempDir(), ".wwctl-overlay-")
if err != nil {
return errors.Wrapf(err, "Failed to create temporary directory for %s", name)
}