From f67ce5ac8d8bc3f47563dd6512946d8947cf412a Mon Sep 17 00:00:00 2001 From: Dave Henderson Date: Thu, 4 Aug 2022 19:52:09 -0400 Subject: Fix lint errors Signed-off-by: Dave Henderson --- cmd/gomplate/main.go | 1 - data/data.go | 39 +++++++++++++++--------- data/datasource_file.go | 4 +-- data/datasource_git.go | 9 +++--- data/datasource_git_test.go | 6 ++-- data/datasource_http.go | 4 +-- data/datasource_stdin.go | 3 +- env/env.go | 4 +-- file/file.go | 4 +-- file/file_test.go | 7 ++--- funcs/aws.go | 1 + funcs/crypto.go | 8 ++--- funcs/doc.go | 1 - funcs/net.go | 1 + gcp/meta.go | 4 +-- internal/tests/integration/basic_test.go | 11 +++---- internal/tests/integration/config_test.go | 7 ++--- internal/tests/integration/file_test.go | 3 +- internal/tests/integration/inputdir_test.go | 39 ++++++++++++------------ internal/tests/integration/inputdir_unix_test.go | 5 ++- vault/auth.go | 4 +-- 21 files changed, 84 insertions(+), 81 deletions(-) diff --git a/cmd/gomplate/main.go b/cmd/gomplate/main.go index ac5fa07b..01f75ea9 100644 --- a/cmd/gomplate/main.go +++ b/cmd/gomplate/main.go @@ -1,6 +1,5 @@ /* The gomplate command - */ package main diff --git a/data/data.go b/data/data.go index 0c81dc54..96f82e7f 100644 --- a/data/data.go +++ b/data/data.go @@ -258,10 +258,13 @@ func autoIndex(i int) string { // CSV - Unmarshal CSV // parameters: -// delim - (optional) the (single-character!) field delimiter, defaults to "," -// in - the CSV-format string to parse +// +// delim - (optional) the (single-character!) field delimiter, defaults to "," +// in - the CSV-format string to parse +// // returns: -// an array of rows, which are arrays of cells (strings) +// +// an array of rows, which are arrays of cells (strings) func CSV(args ...string) ([][]string, error) { records, hdr, err := parseCSV(args...) if err != nil { @@ -275,13 +278,16 @@ func CSV(args ...string) ([][]string, error) { // CSVByRow - Unmarshal CSV in a row-oriented form // parameters: -// delim - (optional) the (single-character!) field delimiter, defaults to "," -// hdr - (optional) comma-separated list of column names, -// set to "" to get auto-named columns (A-Z), omit -// to use the first line -// in - the CSV-format string to parse +// +// delim - (optional) the (single-character!) field delimiter, defaults to "," +// hdr - (optional) comma-separated list of column names, +// set to "" to get auto-named columns (A-Z), omit +// to use the first line +// in - the CSV-format string to parse +// // returns: -// an array of rows, indexed by the header name +// +// an array of rows, indexed by the header name func CSVByRow(args ...string) (rows []map[string]string, err error) { records, hdr, err := parseCSV(args...) if err != nil { @@ -299,13 +305,16 @@ func CSVByRow(args ...string) (rows []map[string]string, err error) { // CSVByColumn - Unmarshal CSV in a Columnar form // parameters: -// delim - (optional) the (single-character!) field delimiter, defaults to "," -// hdr - (optional) comma-separated list of column names, -// set to "" to get auto-named columns (A-Z), omit -// to use the first line -// in - the CSV-format string to parse +// +// delim - (optional) the (single-character!) field delimiter, defaults to "," +// hdr - (optional) comma-separated list of column names, +// set to "" to get auto-named columns (A-Z), omit +// to use the first line +// in - the CSV-format string to parse +// // returns: -// a map of columns, indexed by the header name. values are arrays of strings +// +// a map of columns, indexed by the header name. values are arrays of strings func CSVByColumn(args ...string) (cols map[string][]string, err error) { records, hdr, err := parseCSV(args...) if err != nil { diff --git a/data/datasource_file.go b/data/datasource_file.go index 7619f039..e6be0440 100644 --- a/data/datasource_file.go +++ b/data/datasource_file.go @@ -4,7 +4,7 @@ import ( "bytes" "context" "encoding/json" - "io/ioutil" + "io" "net/url" "os" "path/filepath" @@ -57,7 +57,7 @@ func readFile(ctx context.Context, source *Source, args ...string) ([]byte, erro defer f.Close() - b, err := ioutil.ReadAll(f) + b, err := io.ReadAll(f) if err != nil { return nil, errors.Wrapf(err, "Can't read %s", p) } diff --git a/data/datasource_git.go b/data/datasource_git.go index c2673dd3..c5291413 100644 --- a/data/datasource_git.go +++ b/data/datasource_git.go @@ -5,7 +5,7 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" + "io" "net/url" "os" "path" @@ -136,7 +136,7 @@ func (g gitsource) parseGitPath(u *url.URL, args ...string) (out *url.URL, p str return out, p, err } -//nolint: interfacer +// nolint: interfacer func cloneURL(u *url.URL) *url.URL { out, _ := url.Parse(u.String()) return out @@ -263,7 +263,7 @@ func (g gitsource) read(fs billy.Filesystem, path string) (string, []byte, error return "", nil, fmt.Errorf("can't open %s: %w", path, err) } - b, err := ioutil.ReadAll(f) + b, err := io.ReadAll(f) if err != nil { return "", nil, fmt.Errorf("can't read %s: %w", path, err) } @@ -294,7 +294,8 @@ func (g gitsource) readDir(fs billy.Filesystem, path string) ([]byte, error) { /* auth methods: - ssh named key (no password support) - - GIT_SSH_KEY (base64-encoded) or GIT_SSH_KEY_FILE (base64-encoded, or not) + - GIT_SSH_KEY (base64-encoded) or GIT_SSH_KEY_FILE (base64-encoded, or not) + - ssh agent auth (preferred) - http basic auth (for github, gitlab, bitbucket tokens) - http token auth (bearer token, somewhat unusual) diff --git a/data/datasource_git_test.go b/data/datasource_git_test.go index 0c20c558..157e14a8 100644 --- a/data/datasource_git_test.go +++ b/data/datasource_git_test.go @@ -4,7 +4,7 @@ import ( "context" "encoding/base64" "fmt" - "io/ioutil" + "io" "net/url" "os" "strings" @@ -336,7 +336,7 @@ func TestOpenFileRepo(t *testing.T) { f, err := fs.Open("/foo/bar/hi.txt") assert.NilError(t, err) - b, _ := ioutil.ReadAll(f) + b, _ := io.ReadAll(f) assert.Equal(t, "hello world", string(b)) _, repo, err := g.clone(ctx, mustParseURL("git+file:///repo#main"), 0) @@ -375,7 +375,7 @@ func TestOpenBareFileRepo(t *testing.T) { f, err := fs.Open("/hello.txt") assert.NilError(t, err) - b, _ := ioutil.ReadAll(f) + b, _ := io.ReadAll(f) assert.Equal(t, "hello world", string(b)) } diff --git a/data/datasource_http.go b/data/datasource_http.go index 03e1ac4c..1061a3a1 100644 --- a/data/datasource_http.go +++ b/data/datasource_http.go @@ -2,7 +2,7 @@ package data import ( "context" - "io/ioutil" + "io" "mime" "net/http" "net/url" @@ -39,7 +39,7 @@ func readHTTP(ctx context.Context, source *Source, args ...string) ([]byte, erro if err != nil { return nil, err } - body, err := ioutil.ReadAll(res.Body) + body, err := io.ReadAll(res.Body) if err != nil { return nil, err } diff --git a/data/datasource_stdin.go b/data/datasource_stdin.go index b8bd0eff..4592b209 100644 --- a/data/datasource_stdin.go +++ b/data/datasource_stdin.go @@ -3,7 +3,6 @@ package data import ( "context" "io" - "io/ioutil" "os" "github.com/pkg/errors" @@ -12,7 +11,7 @@ import ( func readStdin(ctx context.Context, source *Source, args ...string) ([]byte, error) { stdin := stdinFromContext(ctx) - b, err := ioutil.ReadAll(stdin) + b, err := io.ReadAll(stdin) if err != nil { return nil, errors.Wrapf(err, "Can't read %s", stdin) } diff --git a/env/env.go b/env/env.go index 4a61eae4..b8bbbfa5 100644 --- a/env/env.go +++ b/env/env.go @@ -2,7 +2,7 @@ package env import ( - "io/ioutil" + "io" "os" "strings" @@ -62,7 +62,7 @@ func readFile(fs afero.Fs, p string) (string, error) { if err != nil { return "", err } - b, err := ioutil.ReadAll(f) + b, err := io.ReadAll(f) if err != nil { return "", err } diff --git a/file/file.go b/file/file.go index 00b3acba..59814a78 100644 --- a/file/file.go +++ b/file/file.go @@ -2,7 +2,7 @@ package file import ( - "io/ioutil" + "io" "os" "path/filepath" "strings" @@ -24,7 +24,7 @@ func Read(filename string) (string, error) { } // nolint: errcheck defer inFile.Close() - bytes, err := ioutil.ReadAll(inFile) + bytes, err := io.ReadAll(inFile) if err != nil { err = errors.Wrapf(err, "read failed for %s", filename) return "", err diff --git a/file/file_test.go b/file/file_test.go index b2d1ee4e..215acbfe 100644 --- a/file/file_test.go +++ b/file/file_test.go @@ -1,7 +1,6 @@ package file import ( - "io/ioutil" "os" "path/filepath" "testing" @@ -75,14 +74,14 @@ func TestWrite(t *testing.T) { err = Write(foopath, []byte("Hello world")) assert.NoError(t, err) - out, err := ioutil.ReadFile(foopath) + out, err := os.ReadFile(foopath) assert.NoError(t, err) assert.Equal(t, "Hello world", string(out)) err = Write(foopath, []byte("truncate")) assert.NoError(t, err) - out, err = ioutil.ReadFile(foopath) + out, err = os.ReadFile(foopath) assert.NoError(t, err) assert.Equal(t, "truncate", string(out)) @@ -90,7 +89,7 @@ func TestWrite(t *testing.T) { err = Write(foopath, []byte("Hello subdirranean world!")) assert.NoError(t, err) - out, err = ioutil.ReadFile(foopath) + out, err = os.ReadFile(foopath) assert.NoError(t, err) assert.Equal(t, "Hello subdirranean world!", string(out)) } diff --git a/funcs/aws.go b/funcs/aws.go index bc4a573c..1a8ef25b 100644 --- a/funcs/aws.go +++ b/funcs/aws.go @@ -10,6 +10,7 @@ import ( // AWSNS - the aws namespace // Deprecated: don't use +// //nolint:golint func AWSNS() *Funcs { return &Funcs{} diff --git a/funcs/crypto.go b/funcs/crypto.go index dc5b0508..3b5b8f15 100644 --- a/funcs/crypto.go +++ b/funcs/crypto.go @@ -106,14 +106,14 @@ func (f CryptoFuncs) SHA512(input interface{}) string { } // SHA512_224 - -//nolint: revive,stylecheck +// nolint: revive,stylecheck func (f CryptoFuncs) SHA512_224(input interface{}) string { out, _ := f.SHA512_224Bytes(input) return fmt.Sprintf("%02x", out) } // SHA512_256 - -//nolint: revive,stylecheck +// nolint: revive,stylecheck func (f CryptoFuncs) SHA512_256(input interface{}) string { out, _ := f.SHA512_256Bytes(input) return fmt.Sprintf("%02x", out) @@ -161,7 +161,7 @@ func (CryptoFuncs) SHA512Bytes(input interface{}) ([]byte, error) { } // SHA512_224 - -//nolint: revive,stylecheck +// nolint: revive,stylecheck func (CryptoFuncs) SHA512_224Bytes(input interface{}) ([]byte, error) { b := sha512.Sum512_224(toBytes(input)) out := make([]byte, len(b)) @@ -170,7 +170,7 @@ func (CryptoFuncs) SHA512_224Bytes(input interface{}) ([]byte, error) { } // SHA512_256 - -//nolint: revive,stylecheck +// nolint: revive,stylecheck func (CryptoFuncs) SHA512_256Bytes(input interface{}) ([]byte, error) { b := sha512.Sum512_256(toBytes(input)) out := make([]byte, len(b)) diff --git a/funcs/doc.go b/funcs/doc.go index cb1a5f5c..69a01281 100644 --- a/funcs/doc.go +++ b/funcs/doc.go @@ -17,6 +17,5 @@ programmatically by external consumers, but instead only to be used as template functions. Deprecated: This package will be made internal in a future major version. - */ package funcs diff --git a/funcs/net.go b/funcs/net.go index edf4aaf3..44b7aabe 100644 --- a/funcs/net.go +++ b/funcs/net.go @@ -104,6 +104,7 @@ func (f NetFuncs) parseStdnetIPNet(prefix interface{}) (*stdnet.IPNet, error) { } // TODO: look at using this instead of parseStdnetIPNet +// //nolint:unused func (f NetFuncs) parseNetipPrefix(prefix interface{}) (netip.Prefix, error) { switch p := prefix.(type) { diff --git a/gcp/meta.go b/gcp/meta.go index bf80821b..b02b1d31 100644 --- a/gcp/meta.go +++ b/gcp/meta.go @@ -2,7 +2,7 @@ package gcp import ( "fmt" - "io/ioutil" + "io" "net/http" "strconv" "strings" @@ -110,7 +110,7 @@ func (c *MetaClient) retrieveMetadata(url string, def ...string) (string, error) return returnDefault(def), nil } - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { return "", fmt.Errorf("failed to read response body from %s: %w", url, err) } diff --git a/internal/tests/integration/basic_test.go b/internal/tests/integration/basic_test.go index a1e2dc70..1c1490a5 100644 --- a/internal/tests/integration/basic_test.go +++ b/internal/tests/integration/basic_test.go @@ -2,7 +2,6 @@ package integration import ( "io/fs" - "io/ioutil" "os" "testing" @@ -90,7 +89,7 @@ func TestBasic_RoutesInputsToProperOutputs(t *testing.T) { assert.NilError(t, err) m := iohelpers.NormalizeFileMode(v.mode) assert.Equal(t, m, info.Mode(), v.path) - content, err := ioutil.ReadFile(v.path) + content, err := os.ReadFile(v.path) assert.NilError(t, err) assert.Equal(t, v.content, string(content)) } @@ -210,7 +209,7 @@ func TestBasic_RoutesInputsToProperOutputsWithChmod(t *testing.T) { info, err := os.Stat(v.path) assert.NilError(t, err) assert.Equal(t, iohelpers.NormalizeFileMode(v.mode), info.Mode()) - content, err := ioutil.ReadFile(v.path) + content, err := os.ReadFile(v.path) assert.NilError(t, err) assert.Equal(t, v.content, string(content)) } @@ -238,7 +237,7 @@ func TestBasic_OverridesOutputModeWithChmod(t *testing.T) { info, err := os.Stat(v.path) assert.NilError(t, err) assert.Equal(t, iohelpers.NormalizeFileMode(v.mode), info.Mode()) - content, err := ioutil.ReadFile(v.path) + content, err := os.ReadFile(v.path) assert.NilError(t, err) assert.Equal(t, v.content, string(content)) } @@ -258,7 +257,7 @@ func TestBasic_AppliesChmodBeforeWrite(t *testing.T) { info, err := os.Stat(out) assert.NilError(t, err) assert.Equal(t, iohelpers.NormalizeFileMode(0644), info.Mode()) - content, err := ioutil.ReadFile(out) + content, err := os.ReadFile(out) assert.NilError(t, err) assert.Equal(t, "hi\n", string(content)) } @@ -272,7 +271,7 @@ func TestBasic_CreatesMissingDirectory(t *testing.T) { info, err := os.Stat(out) assert.NilError(t, err) assert.Equal(t, iohelpers.NormalizeFileMode(0640), info.Mode()) - content, err := ioutil.ReadFile(out) + content, err := os.ReadFile(out) assert.NilError(t, err) assert.Equal(t, "hi\n", string(content)) diff --git a/internal/tests/integration/config_test.go b/internal/tests/integration/config_test.go index f30d263a..1031a18c 100644 --- a/internal/tests/integration/config_test.go +++ b/internal/tests/integration/config_test.go @@ -1,7 +1,6 @@ package integration import ( - "io/ioutil" "os" "testing" @@ -22,7 +21,7 @@ func setupConfigTest(t *testing.T) *fs.Dir { func writeFile(t *testing.T, dir *fs.Dir, f, content string) { f = dir.Join(f) - err := ioutil.WriteFile(f, []byte(content), 0600) + err := os.WriteFile(f, []byte(content), 0600) if err != nil { t.Fatal(err) } @@ -97,7 +96,7 @@ datasources: o, e, err := cmd(t).withDir(tmpDir.Path()).run() assertSuccess(t, o, e, err, "") - b, err := ioutil.ReadFile(tmpDir.Join("outdir", "file")) + b, err := os.ReadFile(tmpDir.Join("outdir", "file")) assert.NilError(t, err) assert.Equal(t, "hello world", string(b)) } @@ -123,7 +122,7 @@ outputFiles: [out] o, e, err := cmd(t).withDir(tmpDir.Path()).run() assertSuccess(t, o, e, err, "") - b, err := ioutil.ReadFile(tmpDir.Join("out")) + b, err := os.ReadFile(tmpDir.Join("out")) assert.NilError(t, err) assert.Equal(t, "hello world", string(b)) } diff --git a/internal/tests/integration/file_test.go b/internal/tests/integration/file_test.go index 1bf31340..ce33fabc 100644 --- a/internal/tests/integration/file_test.go +++ b/internal/tests/integration/file_test.go @@ -1,7 +1,6 @@ package integration import ( - "io/ioutil" "os" "path/filepath" "testing" @@ -34,7 +33,7 @@ func TestFile_Write(t *testing.T) { withDir(outDir).run() assertSuccess(t, o, e, err, "") - out, err := ioutil.ReadFile(filepath.Join(outDir, "out")) + out, err := os.ReadFile(filepath.Join(outDir, "out")) assert.NilError(t, err) assert.Equal(t, "hello world", string(out)) } diff --git a/internal/tests/integration/inputdir_test.go b/internal/tests/integration/inputdir_test.go index e281fb07..509b1193 100644 --- a/internal/tests/integration/inputdir_test.go +++ b/internal/tests/integration/inputdir_test.go @@ -1,7 +1,6 @@ package integration import ( - "io/ioutil" "os" "testing" @@ -47,11 +46,11 @@ func TestInputDir_InputDir(t *testing.T) { ).run() assertSuccess(t, o, e, err, "") - files, err := ioutil.ReadDir(tmpDir.Join("out")) + files, err := os.ReadDir(tmpDir.Join("out")) assert.NilError(t, err) tassert.Len(t, files, 4) - files, err = ioutil.ReadDir(tmpDir.Join("out", "inner")) + files, err = os.ReadDir(tmpDir.Join("out", "inner")) assert.NilError(t, err) tassert.Len(t, files, 1) @@ -70,7 +69,7 @@ func TestInputDir_InputDir(t *testing.T) { assert.NilError(t, err) m := iohelpers.NormalizeFileMode(v.mode) assert.Equal(t, m, info.Mode(), v.path) - content, err := ioutil.ReadFile(v.path) + content, err := os.ReadFile(v.path) assert.NilError(t, err) assert.Equal(t, v.content, string(content)) } @@ -86,11 +85,11 @@ func TestInputDir_InputDirWithModeOverride(t *testing.T) { ).run() assertSuccess(t, o, e, err, "") - files, err := ioutil.ReadDir(tmpDir.Join("out")) + files, err := os.ReadDir(tmpDir.Join("out")) assert.NilError(t, err) tassert.Len(t, files, 4) - files, err = ioutil.ReadDir(tmpDir.Join("out", "inner")) + files, err = os.ReadDir(tmpDir.Join("out", "inner")) assert.NilError(t, err) tassert.Len(t, files, 1) @@ -109,7 +108,7 @@ func TestInputDir_InputDirWithModeOverride(t *testing.T) { assert.NilError(t, err) m := iohelpers.NormalizeFileMode(v.mode) assert.Equal(t, m, info.Mode(), v.path) - content, err := ioutil.ReadFile(v.path) + content, err := os.ReadFile(v.path) assert.NilError(t, err) assert.Equal(t, v.content, string(content)) } @@ -124,11 +123,11 @@ func TestInputDir_OutputMapInline(t *testing.T) { ).withDir(tmpDir.Path()).run() assertSuccess(t, o, e, err, "") - files, err := ioutil.ReadDir(tmpDir.Join("OUT")) + files, err := os.ReadDir(tmpDir.Join("OUT")) assert.NilError(t, err) tassert.Len(t, files, 4) - files, err = ioutil.ReadDir(tmpDir.Join("OUT", "INNER")) + files, err = os.ReadDir(tmpDir.Join("OUT", "INNER")) assert.NilError(t, err) tassert.Len(t, files, 1) @@ -147,7 +146,7 @@ func TestInputDir_OutputMapInline(t *testing.T) { assert.NilError(t, err) m := iohelpers.NormalizeFileMode(v.mode) assert.Equal(t, m, info.Mode(), v.path) - content, err := ioutil.ReadFile(v.path) + content, err := os.ReadFile(v.path) assert.NilError(t, err) assert.Equal(t, v.content, string(content)) } @@ -164,11 +163,11 @@ func TestInputDir_OutputMapExternal(t *testing.T) { ).withDir(tmpDir.Path()).run() assertSuccess(t, o, e, err, "") - files, err := ioutil.ReadDir(tmpDir.Join("out")) + files, err := os.ReadDir(tmpDir.Join("out")) assert.NilError(t, err) tassert.Len(t, files, 4) - files, err = ioutil.ReadDir(tmpDir.Join("out", "inner")) + files, err = os.ReadDir(tmpDir.Join("out", "inner")) assert.NilError(t, err) tassert.Len(t, files, 1) @@ -187,7 +186,7 @@ func TestInputDir_OutputMapExternal(t *testing.T) { assert.NilError(t, err) m := iohelpers.NormalizeFileMode(v.mode) assert.Equal(t, m, info.Mode(), v.path) - content, err := ioutil.ReadFile(v.path) + content, err := os.ReadFile(v.path) assert.NilError(t, err) assert.Equal(t, v.content, string(content)) } @@ -201,27 +200,27 @@ func TestInputDir_DefaultOutputDir(t *testing.T) { ).withDir(tmpDir.Join("out")).run() assertSuccess(t, o, e, err, "") - files, err := ioutil.ReadDir(tmpDir.Join("out")) + files, err := os.ReadDir(tmpDir.Join("out")) assert.NilError(t, err) tassert.Len(t, files, 4) - files, err = ioutil.ReadDir(tmpDir.Join("out", "inner")) + files, err = os.ReadDir(tmpDir.Join("out", "inner")) assert.NilError(t, err) tassert.Len(t, files, 1) - content, err := ioutil.ReadFile(tmpDir.Join("out", "eins.txt")) + content, err := os.ReadFile(tmpDir.Join("out", "eins.txt")) assert.NilError(t, err) assert.Equal(t, "eins", string(content)) - content, err = ioutil.ReadFile(tmpDir.Join("out", "inner", "deux.txt")) + content, err = os.ReadFile(tmpDir.Join("out", "inner", "deux.txt")) assert.NilError(t, err) assert.Equal(t, "deux", string(content)) - content, err = ioutil.ReadFile(tmpDir.Join("out", "drei.sh")) + content, err = os.ReadFile(tmpDir.Join("out", "drei.sh")) assert.NilError(t, err) assert.Equal(t, `#!/bin/sh\necho "hello world"\n`, string(content)) - content, err = ioutil.ReadFile(tmpDir.Join("out", "vier.txt")) + content, err = os.ReadFile(tmpDir.Join("out", "vier.txt")) assert.NilError(t, err) assert.Equal(t, `deux * deux`, string(content)) } @@ -261,7 +260,7 @@ func TestInputDir_InputDirCwd(t *testing.T) { assert.NilError(t, err) m := iohelpers.NormalizeFileMode(v.mode) assert.Equal(t, m, info.Mode(), v.path) - content, err := ioutil.ReadFile(v.path) + content, err := os.ReadFile(v.path) assert.NilError(t, err) assert.Equal(t, v.content, string(content)) } diff --git a/internal/tests/integration/inputdir_unix_test.go b/internal/tests/integration/inputdir_unix_test.go index e72625d0..3ddb8341 100644 --- a/internal/tests/integration/inputdir_unix_test.go +++ b/internal/tests/integration/inputdir_unix_test.go @@ -5,7 +5,6 @@ package integration import ( "fmt" - "io/ioutil" "math" "os" "testing" @@ -49,7 +48,7 @@ func TestInputDir_RespectsUlimit(t *testing.T) { setFileUlimit(8192) assertSuccess(t, o, e, err, "") - files, err := ioutil.ReadDir(testdir.Join("out")) + files, err := os.ReadDir(testdir.Join("out")) assert.NilError(t, err) assert.Equal(t, numfiles, len(files)) @@ -58,7 +57,7 @@ func TestInputDir_RespectsUlimit(t *testing.T) { _, err := os.Stat(f) assert.NilError(t, err) - content, err := ioutil.ReadFile(f) + content, err := os.ReadFile(f) assert.NilError(t, err) expected := fmt.Sprintf("hello world %d\n", i) assert.Equal(t, expected, string(content)) diff --git a/vault/auth.go b/vault/auth.go index 0014664f..848f0aea 100644 --- a/vault/auth.go +++ b/vault/auth.go @@ -2,7 +2,7 @@ package vault import ( "fmt" - "io/ioutil" + "io" "os" "path" "strings" @@ -226,7 +226,7 @@ func (v *Vault) TokenLogin() (string, error) { if err != nil { return "", nil } - b, err := ioutil.ReadAll(f) + b, err := io.ReadAll(f) if err != nil { return "", err } -- cgit v1.2.3