From 6eccae6b5db29047391fae807179af499df6f72d Mon Sep 17 00:00:00 2001 From: gammazero Date: Mon, 8 Jan 2024 14:05:07 -0800 Subject: [PATCH] lint warnings --- dagsync/ipnisync/publisher_test.go | 6 +++--- dagsync/ipnisync/sync.go | 6 +++--- dagsync/sync_test.go | 1 - 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/dagsync/ipnisync/publisher_test.go b/dagsync/ipnisync/publisher_test.go index d77e355..93cf38a 100644 --- a/dagsync/ipnisync/publisher_test.go +++ b/dagsync/ipnisync/publisher_test.go @@ -141,7 +141,7 @@ func TestPublisherWithLibp2pHTTP(t *testing.T) { req.Equal(link.(cidlink.Link).Cid, headCid) - clientSyncer.Sync(ctx, headCid, selectorparse.CommonSelector_MatchPoint) + err = clientSyncer.Sync(ctx, headCid, selectorparse.CommonSelector_MatchPoint) require.NoError(t, err) // Assert that data is loadable from the link system. @@ -230,7 +230,7 @@ func TestExistingServerWithPublisher(t *testing.T) { req.NoError(err) req.Equal(link.(cidlink.Link).Cid, headCid) - clientSyncer.Sync(ctx, headCid, selectorparse.CommonSelector_MatchPoint) + err = clientSyncer.Sync(ctx, headCid, selectorparse.CommonSelector_MatchPoint) require.NoError(t, err) // Assert that data is loadable from the link system. @@ -437,7 +437,7 @@ func TestHandlerPath(t *testing.T) { req.NoError(err) req.Equal(link.(cidlink.Link).Cid, headCid) - clientSyncer.Sync(ctx, headCid, selectorparse.CommonSelector_MatchPoint) + err = clientSyncer.Sync(ctx, headCid, selectorparse.CommonSelector_MatchPoint) require.NoError(t, err) // Assert that data is loadable from the link system. diff --git a/dagsync/ipnisync/sync.go b/dagsync/ipnisync/sync.go index 8b4feed..82da23c 100644 --- a/dagsync/ipnisync/sync.go +++ b/dagsync/ipnisync/sync.go @@ -317,7 +317,7 @@ retry: case http.StatusOK: return cb(resp.Body) case http.StatusNotFound: - io.Copy(io.Discard, resp.Body) + _, _ = io.Copy(io.Discard, resp.Body) if s.plainHTTP && !s.noPath { // Try again with no path for legacy http. log.Warnw("Plain HTTP got not found response, retrying without IPNI path for legacy HTTP") @@ -331,7 +331,7 @@ retry: // being checked already. return fmt.Errorf("content not found: %w", ipld.ErrNotExists{}) case http.StatusForbidden: - io.Copy(io.Discard, resp.Body) + _, _ = io.Copy(io.Discard, resp.Body) if s.plainHTTP && !s.noPath { // Try again with no path for legacy http. log.Warnw("Plain HTTP got forbidden response, retrying without IPNI path for legacy HTTP") @@ -341,7 +341,7 @@ retry: } fallthrough default: - io.Copy(io.Discard, resp.Body) + _, _ = io.Copy(io.Discard, resp.Body) return fmt.Errorf("non success http fetch response at %s: %d", fetchURL.String(), resp.StatusCode) } } diff --git a/dagsync/sync_test.go b/dagsync/sync_test.go index 929c16b..f9e21ef 100644 --- a/dagsync/sync_test.go +++ b/dagsync/sync_test.go @@ -325,7 +325,6 @@ func TestLatestSyncFailure(t *testing.T) { cncl() sub.Close() - dstStore = dssync.MutexWrap(datastore.NewMapDatastore()) sub2, err := dagsync.NewSubscriber(dstHost, dstLnkS, dagsync.RecvAnnounce(testTopic), dagsync.StrictAdsSelector(false)) require.NoError(t, err)