gofmt
This commit was moved from ipfs/go-ipfs-http-client@f3c2c350861470c05617cf74e7b78d06782bb706
Łukasz Magiera committed
Feb 18, 2019 at 17:32 UTC
745bf92506bd488bde4f695c4d644e7d3b58f0a2
4 files changed
+23
-23
client/httpapi/api.go
+3
-3
@@ -128,9 +128,9 @@ func (api *HttpApi) WithOptions(opts ...caopts.ApiOption) (iface.CoreAPI, error)
128
129
func (api *HttpApi) request(command string, args ...string) *RequestBuilder {
130
return &RequestBuilder{
131
- command: command,
132
- args: args,
133
- shell: api,
131
+ command: command,
132
+ args: args,
133
+ shell: api,
134
drainOut: true,
135
}
136
}
client/httpapi/pubsub.go
+4
-4
@@ -59,7 +59,7 @@ func (api *PubsubAPI) Publish(ctx context.Context, topic string, message []byte)
59
type pubsubSub struct {
60
messages chan pubsubMessage
61
62
- done chan struct{}
62
+ done chan struct{}
63
rcloser io.Closer
64
}
65
@@ -70,7 +70,7 @@ type pubsubMessage struct {
70
JTopicIDs []string `json:"topicIDs,omitempty"`
71
72
from peer.ID
73
- err error
73
+ err error
74
}
75
76
func (msg *pubsubMessage) From() peer.ID {
@@ -124,7 +124,7 @@ func (api *PubsubAPI) Subscribe(ctx context.Context, topic string, opts ...caopt
124
125
sub := &pubsubSub{
126
messages: make(chan pubsubMessage),
127
- done: make(chan struct{}),
127
+ done: make(chan struct{}),
128
}
129
130
dec := json.NewDecoder(resp.Output)
@@ -154,7 +154,7 @@ func (api *PubsubAPI) Subscribe(ctx context.Context, topic string, opts ...caopt
154
return sub, nil
155
}
156
157
-func (s*pubsubSub) Close() error {
157
+func (s *pubsubSub) Close() error {
158
if s.done != nil {
159
close(s.done)
160
s.done = nil
client/httpapi/request.go
+11
-11
@@ -7,12 +7,12 @@ import (
7
)
8
9
type Request struct {
10
- ApiBase string
11
- Command string
12
- Args []string
13
- Opts map[string]string
14
- Body io.Reader
15
- Headers map[string]string
10
+ ApiBase string
11
+ Command string
12
+ Args []string
13
+ Opts map[string]string
14
+ Body io.Reader
15
+ Headers map[string]string
16
DrainOut bool // if set, resp.Close will read all remaining data
17
}
18
@@ -26,11 +26,11 @@ func NewRequest(ctx context.Context, url, command string, args ...string) *Reque
26
"stream-channels": "true",
27
}
28
return &Request{
29
- ApiBase: url + "/api/v0",
30
- Command: command,
31
- Args: args,
32
- Opts: opts,
33
- Headers: make(map[string]string),
29
+ ApiBase: url + "/api/v0",
30
+ Command: command,
31
+ Args: args,
32
+ Opts: opts,
33
+ Headers: make(map[string]string),
34
DrainOut: true,
35
}
36
}
client/httpapi/requestbuilder.go
+5
-5
@@ -14,11 +14,11 @@ import (
14
15
// RequestBuilder is an IPFS commands request builder.
16
type RequestBuilder struct {
17
- command string
18
- args []string
19
- opts map[string]string
20
- headers map[string]string
21
- body io.Reader
17
+ command string
18
+ args []string
19
+ opts map[string]string
20
+ headers map[string]string
21
+ body io.Reader
22
drainOut bool
23
24
shell *HttpApi