Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2021-09-17 17:09:53 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2021-09-20 17:22:33 +0300
commit4311879356b4a4fcb704373b33afd41148e34fc7 (patch)
treee266b31c89bb0f3277a995d8902cbf72c7cac10e
parent4d6bbe3774f7c926ad655a26336ff093f1a7a32b (diff)
global: Replace deprecated usage of `ioutil.Discard`
With Go 1.16, the ioutil package was deprecated. Replace our usage of `ioutil.Discard` with `io.Discard` to adapt accordingly.
-rw-r--r--cmd/gitaly-backup/create_test.go4
-rw-r--r--cmd/gitaly-backup/restore_test.go4
-rw-r--r--internal/backchannel/backchannel_test.go3
-rw-r--r--internal/command/command.go3
-rw-r--r--internal/git/catfile/batch_test.go4
-rw-r--r--internal/git/catfile/object_reader.go3
-rw-r--r--internal/git/catfile/object_reader_test.go4
-rw-r--r--internal/git/gitpipe/pipeline_test.go4
-rw-r--r--internal/git/localrepo/refs.go4
-rw-r--r--internal/git/pktline/read_monitor.go3
-rw-r--r--internal/git/stats/http_reference_discovery.go3
-rw-r--r--internal/git/stats/packfile_negotiation.go3
-rw-r--r--internal/gitaly/diff/diff.go3
-rw-r--r--internal/gitaly/hook/transactions_test.go8
-rw-r--r--internal/gitaly/service/blob/blobs.go3
-rw-r--r--internal/gitaly/service/blob/get_blobs.go3
-rw-r--r--internal/gitaly/service/ref/find_all_tags.go5
-rw-r--r--internal/gitaly/service/smarthttp/cache.go3
-rw-r--r--internal/gitlab/http_client.go2
-rw-r--r--internal/log/hook.go6
-rw-r--r--internal/logsanitizer/url_test.go6
-rw-r--r--internal/middleware/featureflag/featureflag_handler_test.go4
-rw-r--r--internal/praefect/coordinator_test.go4
-rw-r--r--internal/streamcache/cache_test.go2
-rw-r--r--internal/tempdir/clean_test.go3
-rw-r--r--internal/testhelper/test_hook.go4
26 files changed, 44 insertions, 54 deletions
diff --git a/cmd/gitaly-backup/create_test.go b/cmd/gitaly-backup/create_test.go
index 68e8dc2bd..bb58c435f 100644
--- a/cmd/gitaly-backup/create_test.go
+++ b/cmd/gitaly-backup/create_test.go
@@ -6,7 +6,7 @@ import (
"encoding/json"
"flag"
"fmt"
- "io/ioutil"
+ "io"
"path/filepath"
"testing"
@@ -59,7 +59,7 @@ func TestCreateSubcommand(t *testing.T) {
require.NoError(t, fs.Parse([]string{"-path", path}))
require.EqualError(t,
- cmd.Run(context.Background(), &stdin, ioutil.Discard),
+ cmd.Run(context.Background(), &stdin, io.Discard),
"create: pipeline: 1 failures encountered")
for _, repo := range repos {
diff --git a/cmd/gitaly-backup/restore_test.go b/cmd/gitaly-backup/restore_test.go
index d5b7be2c3..a5a5e33c4 100644
--- a/cmd/gitaly-backup/restore_test.go
+++ b/cmd/gitaly-backup/restore_test.go
@@ -6,7 +6,7 @@ import (
"encoding/json"
"flag"
"fmt"
- "io/ioutil"
+ "io"
"path/filepath"
"testing"
@@ -66,7 +66,7 @@ func TestRestoreSubcommand(t *testing.T) {
require.NoError(t, fs.Parse([]string{"-path", path}))
require.EqualError(t,
- cmd.Run(context.Background(), &stdin, ioutil.Discard),
+ cmd.Run(context.Background(), &stdin, io.Discard),
"restore: pipeline: 1 failures encountered")
for _, repo := range repos {
diff --git a/internal/backchannel/backchannel_test.go b/internal/backchannel/backchannel_test.go
index 1191737b5..0fe321a46 100644
--- a/internal/backchannel/backchannel_test.go
+++ b/internal/backchannel/backchannel_test.go
@@ -4,7 +4,6 @@ import (
"context"
"fmt"
"io"
- "io/ioutil"
"net"
"sync"
"sync/atomic"
@@ -33,7 +32,7 @@ func (m mockTransactionServer) VoteTransaction(ctx context.Context, req *gitalyp
func newLogger() *logrus.Entry {
logger := logrus.New()
- logger.Out = ioutil.Discard
+ logger.Out = io.Discard
return logrus.NewEntry(logger)
}
diff --git a/internal/command/command.go b/internal/command/command.go
index f8f7e9a0a..d1db84cd1 100644
--- a/internal/command/command.go
+++ b/internal/command/command.go
@@ -5,7 +5,6 @@ import (
"errors"
"fmt"
"io"
- "io/ioutil"
"os"
"os/exec"
"strings"
@@ -269,7 +268,7 @@ func (c *Command) wait() {
if c.reader != nil {
// Prevent the command from blocking on writing to its stdout.
- _, _ = io.Copy(ioutil.Discard, c.reader)
+ _, _ = io.Copy(io.Discard, c.reader)
}
c.waitError = c.cmd.Wait()
diff --git a/internal/git/catfile/batch_test.go b/internal/git/catfile/batch_test.go
index acc4fd3f6..db32c66be 100644
--- a/internal/git/catfile/batch_test.go
+++ b/internal/git/catfile/batch_test.go
@@ -310,13 +310,13 @@ func TestRepeatedCalls(t *testing.T) {
_, err = c.Tree(ctx, treeOid)
require.Error(t, err, "request should fail because of unconsumed blob data")
- _, err = io.CopyN(ioutil.Discard, blobReader, 10)
+ _, err = io.CopyN(io.Discard, blobReader, 10)
require.NoError(t, err)
_, err = c.Tree(ctx, treeOid)
require.Error(t, err, "request should fail because of unconsumed blob data")
- _, err = io.Copy(ioutil.Discard, blobReader)
+ _, err = io.Copy(io.Discard, blobReader)
require.NoError(t, err, "blob reading should still work")
tree2Obj, err := c.Tree(ctx, treeOid)
diff --git a/internal/git/catfile/object_reader.go b/internal/git/catfile/object_reader.go
index 24f74da1f..4d272d041 100644
--- a/internal/git/catfile/object_reader.go
+++ b/internal/git/catfile/object_reader.go
@@ -5,7 +5,6 @@ import (
"context"
"fmt"
"io"
- "io/ioutil"
"sync"
"github.com/opentracing/opentracing-go"
@@ -129,7 +128,7 @@ func (o *objectReader) reader(
if oi.Type != expectedType {
// This is a programmer error and it should never happen. But if it does,
// we need to leave the cat-file process in a good state
- if _, err := io.CopyN(ioutil.Discard, o.stdout, o.n); err != nil {
+ if _, err := io.CopyN(io.Discard, o.stdout, o.n); err != nil {
return nil, err
}
o.n = 0
diff --git a/internal/git/catfile/object_reader_test.go b/internal/git/catfile/object_reader_test.go
index b940f7f2c..dfb3dafe5 100644
--- a/internal/git/catfile/object_reader_test.go
+++ b/internal/git/catfile/object_reader_test.go
@@ -104,7 +104,7 @@ func TestObjectReader_reader(t *testing.T) {
object, err := reader.reader(ctx, commitID.Revision(), "commit")
require.NoError(t, err)
- _, err = io.CopyN(ioutil.Discard, object, 100)
+ _, err = io.CopyN(io.Discard, object, 100)
require.NoError(t, err)
// We haven't yet consumed the previous object, so this must now fail.
@@ -131,7 +131,7 @@ func TestObjectReader_reader(t *testing.T) {
require.Equal(t, float64(1), testutil.ToFloat64(counter.WithLabelValues(objectType)))
- _, err = io.Copy(ioutil.Discard, object)
+ _, err = io.Copy(io.Discard, object)
require.NoError(t, err)
}
})
diff --git a/internal/git/gitpipe/pipeline_test.go b/internal/git/gitpipe/pipeline_test.go
index 180cc4cb0..8546b7809 100644
--- a/internal/git/gitpipe/pipeline_test.go
+++ b/internal/git/gitpipe/pipeline_test.go
@@ -273,7 +273,7 @@ func TestPipeline_revlist(t *testing.T) {
for catfileObjectIter.Next() {
i++
- _, err := io.Copy(ioutil.Discard, catfileObjectIter.Result().ObjectReader)
+ _, err := io.Copy(io.Discard, catfileObjectIter.Result().ObjectReader)
require.NoError(t, err)
if i == 3 {
@@ -317,7 +317,7 @@ func TestPipeline_revlist(t *testing.T) {
// the object reader.
go func(object CatfileObjectResult) {
defer wg.Done()
- _, err := io.Copy(ioutil.Discard, object.ObjectReader)
+ _, err := io.Copy(io.Discard, object.ObjectReader)
require.NoError(t, err)
}(catfileObjectIter.Result())
}
diff --git a/internal/git/localrepo/refs.go b/internal/git/localrepo/refs.go
index 0ebe4aa91..0ac4bf969 100644
--- a/internal/git/localrepo/refs.go
+++ b/internal/git/localrepo/refs.go
@@ -6,7 +6,7 @@ import (
"context"
"errors"
"fmt"
- "io/ioutil"
+ "io"
"strings"
"gitlab.com/gitlab-org/gitaly/v14/internal/command"
@@ -43,7 +43,7 @@ func (repo *Repo) ResolveRevision(ctx context.Context, revision git.Revision) (g
Flags: []git.Option{git.Flag{Name: "--verify"}},
Args: []string{revision.String()},
},
- git.WithStderr(ioutil.Discard),
+ git.WithStderr(io.Discard),
git.WithStdout(&stdout),
); err != nil {
if _, ok := command.ExitStatus(err); ok {
diff --git a/internal/git/pktline/read_monitor.go b/internal/git/pktline/read_monitor.go
index 4f74fda05..1c2f6d354 100644
--- a/internal/git/pktline/read_monitor.go
+++ b/internal/git/pktline/read_monitor.go
@@ -4,7 +4,6 @@ import (
"bytes"
"context"
"io"
- "io/ioutil"
"os"
"time"
)
@@ -77,6 +76,6 @@ func (m *ReadMonitor) Monitor(pkt []byte, timeout time.Duration, cancelFn func()
}
// Complete the read loop, then signal completion on pr by closing pw
- _, _ = io.Copy(ioutil.Discard, teeReader)
+ _, _ = io.Copy(io.Discard, teeReader)
_ = m.pw.Close()
}
diff --git a/internal/git/stats/http_reference_discovery.go b/internal/git/stats/http_reference_discovery.go
index 5c69f5674..170034e0c 100644
--- a/internal/git/stats/http_reference_discovery.go
+++ b/internal/git/stats/http_reference_discovery.go
@@ -5,7 +5,6 @@ import (
"context"
"fmt"
"io"
- "io/ioutil"
"net/http"
"time"
)
@@ -84,7 +83,7 @@ func performHTTPReferenceDiscovery(
return HTTPReferenceDiscovery{}, err
}
defer func() {
- _, _ = io.Copy(ioutil.Discard, resp.Body)
+ _, _ = io.Copy(io.Discard, resp.Body)
_ = resp.Body.Close()
}()
diff --git a/internal/git/stats/packfile_negotiation.go b/internal/git/stats/packfile_negotiation.go
index 72bd015a6..8b27349f5 100644
--- a/internal/git/stats/packfile_negotiation.go
+++ b/internal/git/stats/packfile_negotiation.go
@@ -4,7 +4,6 @@ import (
"errors"
"fmt"
"io"
- "io/ioutil"
"strings"
"github.com/prometheus/client_golang/prometheus"
@@ -47,7 +46,7 @@ func ParsePackfileNegotiation(body io.Reader) (PackfileNegotiation, error) {
// have <OID>
// flush|done
func (n *PackfileNegotiation) Parse(body io.Reader) error {
- defer func() { _, _ = io.Copy(ioutil.Discard, body) }()
+ defer func() { _, _ = io.Copy(io.Discard, body) }()
scanner := pktline.NewScanner(body)
diff --git a/internal/gitaly/diff/diff.go b/internal/gitaly/diff/diff.go
index 38f763728..3fb8191f7 100644
--- a/internal/gitaly/diff/diff.go
+++ b/internal/gitaly/diff/diff.go
@@ -5,7 +5,6 @@ import (
"bytes"
"fmt"
"io"
- "io/ioutil"
"regexp"
"strconv"
@@ -120,7 +119,7 @@ func NewDiffParser(src io.Reader, limits Limits) *Parser {
func (parser *Parser) Parse() bool {
if parser.finished || len(parser.rawLines) == 0 {
// In case we didn't consume the whole output due to reaching limitations
- _, _ = io.Copy(ioutil.Discard, parser.patchReader)
+ _, _ = io.Copy(io.Discard, parser.patchReader)
return false
}
diff --git a/internal/gitaly/hook/transactions_test.go b/internal/gitaly/hook/transactions_test.go
index d3d65e646..b9ee01858 100644
--- a/internal/gitaly/hook/transactions_test.go
+++ b/internal/gitaly/hook/transactions_test.go
@@ -4,7 +4,7 @@ import (
"context"
"errors"
"fmt"
- "io/ioutil"
+ "io"
"strings"
"testing"
"time"
@@ -56,13 +56,13 @@ func TestHookManager_stopCalled(t *testing.T) {
}
preReceiveFunc := func(t *testing.T) error {
- return hookManager.PreReceiveHook(ctx, repo, nil, []string{hooksPayload}, strings.NewReader("changes"), ioutil.Discard, ioutil.Discard)
+ return hookManager.PreReceiveHook(ctx, repo, nil, []string{hooksPayload}, strings.NewReader("changes"), io.Discard, io.Discard)
}
updateFunc := func(t *testing.T) error {
- return hookManager.UpdateHook(ctx, repo, "ref", git.ZeroOID.String(), git.ZeroOID.String(), []string{hooksPayload}, ioutil.Discard, ioutil.Discard)
+ return hookManager.UpdateHook(ctx, repo, "ref", git.ZeroOID.String(), git.ZeroOID.String(), []string{hooksPayload}, io.Discard, io.Discard)
}
postReceiveFunc := func(t *testing.T) error {
- return hookManager.PostReceiveHook(ctx, repo, nil, []string{hooksPayload}, strings.NewReader("changes"), ioutil.Discard, ioutil.Discard)
+ return hookManager.PostReceiveHook(ctx, repo, nil, []string{hooksPayload}, strings.NewReader("changes"), io.Discard, io.Discard)
}
for _, tc := range []struct {
diff --git a/internal/gitaly/service/blob/blobs.go b/internal/gitaly/service/blob/blobs.go
index cb6dcfc53..651bbdf29 100644
--- a/internal/gitaly/service/blob/blobs.go
+++ b/internal/gitaly/service/blob/blobs.go
@@ -5,7 +5,6 @@ import (
"errors"
"fmt"
"io"
- "io/ioutil"
"strings"
"gitlab.com/gitlab-org/gitaly/v14/internal/git"
@@ -169,7 +168,7 @@ func processBlobs(
// Discard trailing blob data in case the blob is bigger than the read
// limit.
- _, err = io.Copy(ioutil.Discard, blob.ObjectReader)
+ _, err = io.Copy(io.Discard, blob.ObjectReader)
if err != nil {
return helper.ErrInternal(fmt.Errorf("discarding blob data: %w", err))
}
diff --git a/internal/gitaly/service/blob/get_blobs.go b/internal/gitaly/service/blob/get_blobs.go
index c2cfda64f..3051492d2 100644
--- a/internal/gitaly/service/blob/get_blobs.go
+++ b/internal/gitaly/service/blob/get_blobs.go
@@ -3,7 +3,6 @@ package blob
import (
"bytes"
"io"
- "io/ioutil"
"gitlab.com/gitlab-org/gitaly/v14/internal/git"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/catfile"
@@ -133,7 +132,7 @@ func sendBlobTreeEntry(response *gitalypb.GetBlobsResponse, stream gitalypb.Blob
return status.Errorf(codes.Unavailable, "GetBlobs: send: %v", err)
}
- if _, err := io.Copy(ioutil.Discard, blobObj.Reader); err != nil {
+ if _, err := io.Copy(io.Discard, blobObj.Reader); err != nil {
return status.Errorf(codes.Unavailable, "GetBlobs: discarding data: %v", err)
}
diff --git a/internal/gitaly/service/ref/find_all_tags.go b/internal/gitaly/service/ref/find_all_tags.go
index 057414302..a52156191 100644
--- a/internal/gitaly/service/ref/find_all_tags.go
+++ b/internal/gitaly/service/ref/find_all_tags.go
@@ -6,7 +6,6 @@ import (
"errors"
"fmt"
"io"
- "io/ioutil"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/catfile"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/gitpipe"
@@ -137,7 +136,7 @@ func (s *server) findAllTags(ctx context.Context, repo *localrepo.Repo, sortFiel
return fmt.Errorf("parsing tagged commit: %w", err)
}
} else {
- if _, err := io.Copy(ioutil.Discard, peeledTag.ObjectReader); err != nil {
+ if _, err := io.Copy(io.Discard, peeledTag.ObjectReader); err != nil {
return fmt.Errorf("discarding tagged object contents: %w", err)
}
}
@@ -152,7 +151,7 @@ func (s *server) findAllTags(ctx context.Context, repo *localrepo.Repo, sortFiel
TargetCommit: commit,
}
default:
- if _, err := io.Copy(ioutil.Discard, tag.ObjectReader); err != nil {
+ if _, err := io.Copy(io.Discard, tag.ObjectReader); err != nil {
return fmt.Errorf("discarding tag object contents: %w", err)
}
diff --git a/internal/gitaly/service/smarthttp/cache.go b/internal/gitaly/service/smarthttp/cache.go
index 9857e3741..5531d0236 100644
--- a/internal/gitaly/service/smarthttp/cache.go
+++ b/internal/gitaly/service/smarthttp/cache.go
@@ -3,7 +3,6 @@ package smarthttp
import (
"context"
"io"
- "io/ioutil"
"sync"
"github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus/ctxlogrus"
@@ -92,7 +91,7 @@ func (c infoRefCache) tryCache(ctx context.Context, in *gitalypb.InfoRefsRequest
// discard remaining bytes if caching stream
// failed so that tee reader is not blocked
- _, err = io.Copy(ioutil.Discard, tr)
+ _, err = io.Copy(io.Discard, tr)
if err != nil {
logger.WithError(err).
Error("unable to discard remaining InfoRefsUploadPack cache stream")
diff --git a/internal/gitlab/http_client.go b/internal/gitlab/http_client.go
index 3395d1c7a..5024ef7e2 100644
--- a/internal/gitlab/http_client.go
+++ b/internal/gitlab/http_client.go
@@ -297,7 +297,7 @@ func (c *HTTPClient) Check(ctx context.Context) (*CheckInfo, error) {
}
func (c *HTTPClient) finalizeResponse(resp *http.Response) {
- if _, err := io.Copy(ioutil.Discard, resp.Body); err != nil {
+ if _, err := io.Copy(io.Discard, resp.Body); err != nil {
c.logger.WithError(err).Errorf("discard body error for the request %q", resp.Request.RequestURI)
}
if err := resp.Body.Close(); err != nil {
diff --git a/internal/log/hook.go b/internal/log/hook.go
index 3ad214401..d9a995f3e 100644
--- a/internal/log/hook.go
+++ b/internal/log/hook.go
@@ -2,7 +2,7 @@ package log
import (
"fmt"
- "io/ioutil"
+ "io"
"os"
"path/filepath"
@@ -20,13 +20,13 @@ func NewHookLogger() *HookLogger {
logDir := os.Getenv(GitalyLogDirEnvKey)
if logDir == "" {
- logger.SetOutput(ioutil.Discard)
+ logger.SetOutput(io.Discard)
return &HookLogger{logger: logger}
}
logFile, err := os.OpenFile(filepath.Join(logDir, "gitaly_hooks.log"), os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0o644)
if err != nil {
- logger.SetOutput(ioutil.Discard)
+ logger.SetOutput(io.Discard)
} else {
logger.SetOutput(logFile)
}
diff --git a/internal/logsanitizer/url_test.go b/internal/logsanitizer/url_test.go
index 8e827ea10..ae9eee5ea 100644
--- a/internal/logsanitizer/url_test.go
+++ b/internal/logsanitizer/url_test.go
@@ -3,7 +3,7 @@ package logsanitizer
import (
"bytes"
"fmt"
- "io/ioutil"
+ "io"
"testing"
log "github.com/sirupsen/logrus"
@@ -101,7 +101,7 @@ func BenchmarkUrlSanitizerWithoutSanitization(b *testing.B) {
urlSanitizer := NewURLSanitizerHook()
logger := log.New()
- logger.Out = ioutil.Discard
+ logger.Out = io.Discard
logger.Hooks.Add(urlSanitizer)
benchmarkLogging(logger, b)
@@ -115,7 +115,7 @@ func BenchmarkUrlSanitizerWithSanitization(b *testing.B) {
)
logger := log.New()
- logger.Out = ioutil.Discard
+ logger.Out = io.Discard
logger.Hooks.Add(urlSanitizer)
benchmarkLogging(logger, b)
diff --git a/internal/middleware/featureflag/featureflag_handler_test.go b/internal/middleware/featureflag/featureflag_handler_test.go
index fdca12319..36fde745f 100644
--- a/internal/middleware/featureflag/featureflag_handler_test.go
+++ b/internal/middleware/featureflag/featureflag_handler_test.go
@@ -2,7 +2,7 @@ package featureflag
import (
"context"
- "io/ioutil"
+ "io"
"testing"
grpcmw "github.com/grpc-ecosystem/go-grpc-middleware"
@@ -73,7 +73,7 @@ func setup() (context.Context, *test.Hook) {
func setupContext() (context.Context, *test.Hook) {
ctx := context.Background()
logger := logrus.New()
- logger.SetOutput(ioutil.Discard)
+ logger.SetOutput(io.Discard)
hook := test.NewLocal(logger)
ctx = ctxlogrus.ToContext(ctx, logrus.NewEntry(logger))
diff --git a/internal/praefect/coordinator_test.go b/internal/praefect/coordinator_test.go
index 13fd4263d..2f626eac2 100644
--- a/internal/praefect/coordinator_test.go
+++ b/internal/praefect/coordinator_test.go
@@ -4,7 +4,7 @@ import (
"context"
"errors"
"fmt"
- "io/ioutil"
+ "io"
"math/rand"
"strings"
"sync"
@@ -53,7 +53,7 @@ import (
var testLogger = logrus.New()
func init() {
- testLogger.SetOutput(ioutil.Discard)
+ testLogger.SetOutput(io.Discard)
}
func TestSecondaryRotation(t *testing.T) {
diff --git a/internal/streamcache/cache_test.go b/internal/streamcache/cache_test.go
index a21b726ed..c8aaf17c1 100644
--- a/internal/streamcache/cache_test.go
+++ b/internal/streamcache/cache_test.go
@@ -326,7 +326,7 @@ func TestCache_failedWrite(t *testing.T) {
require.NoError(t, err)
require.True(t, created)
- _, err = io.Copy(ioutil.Discard, r1)
+ _, err = io.Copy(io.Discard, r1)
require.NoError(t, err, "errors on the write end are not propagated via Read()")
require.NoError(t, r1.Close(), "errors on the write end are not propagated via Close()")
require.Error(t, r1.Wait(context.Background()), "error propagation happens via Wait()")
diff --git a/internal/tempdir/clean_test.go b/internal/tempdir/clean_test.go
index 890ebeee5..98bf9936c 100644
--- a/internal/tempdir/clean_test.go
+++ b/internal/tempdir/clean_test.go
@@ -1,6 +1,7 @@
package tempdir
import (
+ "io"
"io/ioutil"
"os"
"path/filepath"
@@ -59,7 +60,7 @@ func TestCleanTempDir(t *testing.T) {
gittest.CloneRepo(t, cfg, cfg.Storages[0])
logrus.SetLevel(logrus.InfoLevel)
- logrus.SetOutput(ioutil.Discard)
+ logrus.SetOutput(io.Discard)
hook := test.NewGlobal()
diff --git a/internal/testhelper/test_hook.go b/internal/testhelper/test_hook.go
index 85fe4d244..c10e51823 100644
--- a/internal/testhelper/test_hook.go
+++ b/internal/testhelper/test_hook.go
@@ -1,7 +1,7 @@
package testhelper
import (
- "io/ioutil"
+ "io"
"testing"
log "github.com/sirupsen/logrus"
@@ -13,7 +13,7 @@ var NewTestLogger = DiscardTestLogger
// DiscardTestLogger created a logrus hook that discards everything.
func DiscardTestLogger(tb testing.TB) *log.Logger {
logger := log.New()
- logger.Out = ioutil.Discard
+ logger.Out = io.Discard
return logger
}