fix a bunch of go vet errors
License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>
Steven Allen committed
Feb 20, 2018 at 17:37 UTC
45756b6d64c8373e41727fab9a8798eb10275f80
8 files changed
+26
-12
commands/legacy/request.go
+11
-3
@@ -77,7 +77,7 @@ func (r *requestWrapper) Option(name string) *cmdkit.OptionValue {
77
78
optDefs, err := r.req.Root.GetOptions(r.req.Path)
79
if err != nil {
80
- return &cmdkit.OptionValue{nil, false, nil}
80
+ return &cmdkit.OptionValue{}
81
}
82
for _, def := range optDefs {
83
for _, optName := range def.Names() {
@@ -95,11 +95,19 @@ func (r *requestWrapper) Option(name string) *cmdkit.OptionValue {
95
for _, n := range option.Names() {
96
val, found := r.req.Options[n]
97
if found {
98
- return &cmdkit.OptionValue{val, found, option}
98
+ return &cmdkit.OptionValue{
99
+ Value: val,
100
+ ValueFound: found,
101
+ Def: option,
102
+ }
103
}
104
}
105
102
- return &cmdkit.OptionValue{option.Default(), false, option}
106
+ return &cmdkit.OptionValue{
107
+ Value: option.Default(),
108
+ ValueFound: false,
109
+ Def: option,
110
+ }
111
}
112
113
func (r *requestWrapper) Options() cmdkit.OptMap {
commands/legacy/response.go
+1
-1
@@ -155,7 +155,7 @@ func (r *fakeResponse) SetOutput(v interface{}) {
155
_, isReader := v.(io.Reader)
156
157
if t != nil && t.Kind() != reflect.Chan && !isReader {
158
- v = cmds.Single{v}
158
+ v = cmds.Single{Value: v}
159
}
160
161
r.out = v
commands/request.go
+10
-2
@@ -161,11 +161,19 @@ func (r *request) Option(name string) *cmdkit.OptionValue {
161
for _, n := range option.Names() {
162
val, found := r.options[n]
163
if found {
164
- return &cmdkit.OptionValue{val, found, option}
164
+ return &cmdkit.OptionValue{
165
+ Value: val,
166
+ ValueFound: found,
167
+ Def: option,
168
+ }
169
}
170
}
171
168
- return &cmdkit.OptionValue{option.Default(), false, option}
172
+ return &cmdkit.OptionValue{
173
+ Value: option.Default(),
174
+ ValueFound: false,
175
+ Def: option,
176
+ }
177
}
178
179
// Options returns a copy of the option map
core/commands/get.go
+1
-1
@@ -247,7 +247,7 @@ func (gw *getWriter) writeExtracted(r io.Reader, fpath string) error {
247
defer bar.Finish()
248
defer bar.Set64(gw.Size)
249
250
- extractor := &tar.Extractor{fpath, bar.Add64}
250
+ extractor := &tar.Extractor{Path: fpath, Progress: bar.Add64}
251
return extractor.Extract(r)
252
}
253
core/coreapi/block.go
-2
@@ -111,8 +111,6 @@ func (api *BlockAPI) Rm(ctx context.Context, p coreiface.Path, opts ...caopts.Bl
111
case <-ctx.Done():
112
return ctx.Err()
113
}
114
-
115
- return nil
114
}
115
116
func (api *BlockAPI) Stat(ctx context.Context, p coreiface.Path) (coreiface.BlockStat, error) {
core/coreapi/object_test.go
+1
-1
@@ -268,7 +268,7 @@ func TestObjectAddLinkCreate(t *testing.T) {
268
t.Fatal("expected an error")
269
}
270
if err.Error() != "no link by that name" {
271
- t.Fatal("unexpected error: %s", err.Error())
271
+ t.Fatalf("unexpected error: %s", err.Error())
272
}
273
274
p3, err = api.Object().AddLink(ctx, p2, "abc/d", p2, api.Object().WithCreate(true))
core/coreapi/unixfs.go
+1
-1
@@ -71,7 +71,7 @@ func (api *UnixfsAPI) Ls(ctx context.Context, p coreiface.Path) ([]*coreiface.Li
71
72
links := make([]*coreiface.Link, len(ndlinks))
73
for i, l := range ndlinks {
74
- links[i] = &coreiface.Link{l.Name, l.Size, l.Cid}
74
+ links[i] = &coreiface.Link{Name: l.Name, Size: l.Size, Cid: l.Cid}
75
}
76
return links, nil
77
}
core/corehttp/metrics_test.go
+1
-1
@@ -45,6 +45,6 @@ func TestPeersTotal(t *testing.T) {
45
t.Fatalf("expected 1 peers transport, got %d", len(actual))
46
}
47
if actual["/ip4/tcp"] != float64(3) {
48
- t.Fatalf("expected 3 peers, got %s", actual["/ip4/tcp"])
48
+ t.Fatalf("expected 3 peers, got %f", actual["/ip4/tcp"])
49
}
50
}