Update go version, modules and remove ioutil
This commit is contained in:
parent
6f0401fc73
commit
d226d831bd
31 changed files with 576 additions and 288 deletions
|
|
@ -24,7 +24,6 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"math/rand" // #nosec
|
||||
"net"
|
||||
"net/url"
|
||||
|
|
@ -76,7 +75,7 @@ type Template struct {
|
|||
//NewTemplate returns a new Template instance or an
|
||||
//error if the specified template file contains errors
|
||||
func NewTemplate(file string) (*Template, error) {
|
||||
data, err := ioutil.ReadFile(file)
|
||||
data, err := os.ReadFile(file)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "unexpected error reading template %v", file)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ import (
|
|||
"bytes"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"os"
|
||||
"path"
|
||||
|
|
@ -538,7 +537,7 @@ func TestTemplateWithData(t *testing.T) {
|
|||
t.Errorf("unexpected error reading json file: %v", err)
|
||||
}
|
||||
defer f.Close()
|
||||
data, err := ioutil.ReadFile(f.Name())
|
||||
data, err := os.ReadFile(f.Name())
|
||||
if err != nil {
|
||||
t.Error("unexpected error reading json file: ", err)
|
||||
}
|
||||
|
|
@ -582,7 +581,7 @@ func BenchmarkTemplateWithData(b *testing.B) {
|
|||
b.Errorf("unexpected error reading json file: %v", err)
|
||||
}
|
||||
defer f.Close()
|
||||
data, err := ioutil.ReadFile(f.Name())
|
||||
data, err := os.ReadFile(f.Name())
|
||||
if err != nil {
|
||||
b.Error("unexpected error reading json file: ", err)
|
||||
}
|
||||
|
|
@ -1657,7 +1656,7 @@ func TestCleanConf(t *testing.T) {
|
|||
}
|
||||
actual := &bytes.Buffer{}
|
||||
{
|
||||
data, err := ioutil.ReadFile(testDataDir + "/cleanConf.src.conf")
|
||||
data, err := os.ReadFile(testDataDir + "/cleanConf.src.conf")
|
||||
if err != nil {
|
||||
t.Error("unexpected error reading conf file: ", err)
|
||||
}
|
||||
|
|
@ -1668,7 +1667,7 @@ func TestCleanConf(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
expected, err := ioutil.ReadFile(testDataDir + "/cleanConf.expected.conf")
|
||||
expected, err := os.ReadFile(testDataDir + "/cleanConf.expected.conf")
|
||||
if err != nil {
|
||||
t.Error("unexpected error reading conf file: ", err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue