Skip to content

Commit 0c9c9b9

Browse files
authored
Merge pull request ipfs/go-ipfs-http-client#157 from ipfs/web3-bot/sync
sync: update CI config files This commit was moved from ipfs/go-ipfs-http-client@171fcd5
2 parents 1cdb9ad + 1193b29 commit 0c9c9b9

File tree

9 files changed

+15
-24
lines changed

9 files changed

+15
-24
lines changed

client/httpapi/api.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package httpapi
33
import (
44
"errors"
55
"fmt"
6-
"io/ioutil"
76
"net/http"
87
"os"
98
"path/filepath"
@@ -74,7 +73,7 @@ func ApiAddr(ipfspath string) (ma.Multiaddr, error) {
7473

7574
apiFile := filepath.Join(baseDir, DefaultApiFile)
7675

77-
api, err := ioutil.ReadFile(apiFile)
76+
api, err := os.ReadFile(apiFile)
7877
if err != nil {
7978
return nil, err
8079
}

client/httpapi/api_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package httpapi
22

33
import (
44
"context"
5-
"io/ioutil"
65
"net/http"
76
"net/http/httptest"
87
"os"
@@ -92,7 +91,7 @@ func (np *NodeProvider) MakeAPISwarm(ctx context.Context, fullIdentity bool, n i
9291

9392
func (NodeProvider) makeAPISwarm(ctx context.Context, fullIdentity bool, n int) ([]iface.CoreAPI, error) {
9493

95-
dir, err := ioutil.TempDir("", "httpapi-tb-")
94+
dir, err := os.MkdirTemp("", "httpapi-tb-")
9695
if err != nil {
9796
return nil, err
9897
}

client/httpapi/apifile.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"encoding/json"
66
"fmt"
77
"io"
8-
"io/ioutil"
98

109
"github.com/ipfs/go-cid"
1110
files "github.com/ipfs/go-ipfs-files"
@@ -113,7 +112,7 @@ func (f *apiFile) Seek(offset int64, whence int) (int64, error) {
113112
}
114113

115114
if f.at < offset && offset-f.at < forwardSeekLimit { //forward skip
116-
r, err := io.CopyN(ioutil.Discard, f.r.Output, offset-f.at)
115+
r, err := io.CopyN(io.Discard, f.r.Output, offset-f.at)
117116

118117
f.at += r
119118
return f.at, err

client/httpapi/dag.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"bytes"
55
"context"
66
"fmt"
7-
"io/ioutil"
7+
"io"
88

99
blocks "github.com/ipfs/go-block-format"
1010
"github.com/ipfs/go-cid"
@@ -24,7 +24,7 @@ func (api *HttpDagServ) Get(ctx context.Context, c cid.Cid) (format.Node, error)
2424
return nil, err
2525
}
2626

27-
data, err := ioutil.ReadAll(r)
27+
data, err := io.ReadAll(r)
2828
if err != nil {
2929
return nil, err
3030
}

client/httpapi/errors.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ func parseErrNotFoundWithFallbackToError(msg error) error {
4949
return msg
5050
}
5151

52-
//lint:ignore ST1008 this function is not using the error as a mean to return failure but it massages it to return the correct type
5352
func parseErrNotFound(msg string) (error, bool) {
5453
if msg == "" {
5554
return nil, true // Fast path
@@ -72,7 +71,6 @@ func parseErrNotFound(msg string) (error, bool) {
7271
// - Double Quotes: "\"" this is for parsing %q and %#v formating
7372
const cidBreakSet = " \t\n\r\v\f;\""
7473

75-
//lint:ignore ST1008 using error as values
7674
func parseIPLDErrNotFound(msg string) (error, bool) {
7775
// The patern we search for is:
7876
const ipldErrNotFoundKey = "ipld: could not find " /*CID*/
@@ -159,7 +157,6 @@ func (e blockstoreNotFoundMatchingIPLDErrNotFound) Is(err error) bool {
159157
return ok
160158
}
161159

162-
//lint:ignore ST1008 using error as values
163160
func parseBlockstoreNotFound(msg string) (error, bool) {
164161
if !strings.Contains(msg, "blockstore: block not found") {
165162
return nil, false

client/httpapi/name.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import (
66
"fmt"
77
"io"
88

9-
"github.com/ipfs/interface-go-ipfs-core"
9+
iface "github.com/ipfs/interface-go-ipfs-core"
1010
caopts "github.com/ipfs/interface-go-ipfs-core/options"
11-
"github.com/ipfs/interface-go-ipfs-core/options/namesys"
11+
nsopts "github.com/ipfs/interface-go-ipfs-core/options/namesys"
1212
"github.com/ipfs/interface-go-ipfs-core/path"
1313
)
1414

client/httpapi/object.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@ import (
55
"context"
66
"fmt"
77
"io"
8-
"io/ioutil"
98

109
"github.com/ipfs/go-cid"
1110
ipld "github.com/ipfs/go-ipld-format"
1211
"github.com/ipfs/go-merkledag"
1312
ft "github.com/ipfs/go-unixfs"
14-
"github.com/ipfs/interface-go-ipfs-core"
13+
iface "github.com/ipfs/interface-go-ipfs-core"
1514
caopts "github.com/ipfs/interface-go-ipfs-core/options"
1615
"github.com/ipfs/interface-go-ipfs-core/path"
1716
)
@@ -71,7 +70,7 @@ func (api *ObjectAPI) Get(ctx context.Context, p path.Path) (ipld.Node, error) {
7170
if err != nil {
7271
return nil, err
7372
}
74-
b, err := ioutil.ReadAll(r)
73+
b, err := io.ReadAll(r)
7574
if err != nil {
7675
return nil, err
7776
}

client/httpapi/requestbuilder.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ import (
55
"context"
66
"fmt"
77
"io"
8-
"io/ioutil"
98
"strconv"
109
"strings"
1110

12-
"github.com/ipfs/go-ipfs-files"
11+
files "github.com/ipfs/go-ipfs-files"
1312
)
1413

1514
type RequestBuilder interface {
@@ -59,7 +58,7 @@ func (r *requestBuilder) Body(body io.Reader) RequestBuilder {
5958

6059
// FileBody sets the request body to the given reader wrapped into multipartreader.
6160
func (r *requestBuilder) FileBody(body io.Reader) RequestBuilder {
62-
pr, _ := files.NewReaderPathFile("/dev/stdin", ioutil.NopCloser(body), nil)
61+
pr, _ := files.NewReaderPathFile("/dev/stdin", io.NopCloser(body), nil)
6362
d := files.NewMapDirectory(map[string]files.Node{"": pr})
6463
r.body = files.NewMultiFileReader(d, false)
6564

client/httpapi/response.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"errors"
66
"fmt"
77
"io"
8-
"io/ioutil"
98
"mime"
109
"net/http"
1110
"net/url"
@@ -45,7 +44,7 @@ func (r *Response) Close() error {
4544
if r.Output != nil {
4645

4746
// drain output (response body)
48-
_, err1 := io.Copy(ioutil.Discard, r.Output)
47+
_, err1 := io.Copy(io.Discard, r.Output)
4948
err2 := r.Output.Close()
5049
if err1 != nil {
5150
return err1
@@ -117,7 +116,7 @@ func (r *Request) Send(c *http.Client) (*Response, error) {
117116
case resp.StatusCode == http.StatusNotFound:
118117
e.Message = "command not found"
119118
case contentType == "text/plain":
120-
out, err := ioutil.ReadAll(resp.Body)
119+
out, err := io.ReadAll(resp.Body)
121120
if err != nil {
122121
fmt.Fprintf(os.Stderr, "ipfs-shell: warning! response (%d) read error: %s\n", resp.StatusCode, err)
123122
}
@@ -140,7 +139,7 @@ func (r *Request) Send(c *http.Client) (*Response, error) {
140139
// This is a server-side bug (probably).
141140
e.Code = cmds.ErrImplementation
142141
fmt.Fprintf(os.Stderr, "ipfs-shell: warning! unhandled response (%d) encoding: %s", resp.StatusCode, contentType)
143-
out, err := ioutil.ReadAll(resp.Body)
142+
out, err := io.ReadAll(resp.Body)
144143
if err != nil {
145144
fmt.Fprintf(os.Stderr, "ipfs-shell: response (%d) read error: %s\n", resp.StatusCode, err)
146145
}
@@ -150,7 +149,7 @@ func (r *Request) Send(c *http.Client) (*Response, error) {
150149
nresp.Output = nil
151150

152151
// drain body and close
153-
_, _ = io.Copy(ioutil.Discard, resp.Body)
152+
_, _ = io.Copy(io.Discard, resp.Body)
154153
_ = resp.Body.Close()
155154
}
156155

0 commit comments

Comments
 (0)