1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

builder-next: explicitely ignore unhandled errors (errcheck)

```
builder/builder-next/adapters/containerimage/pull.go:278:23: Error return value of `resolveProgressDone` is not checked (errcheck)
builder/builder-next/adapters/containerimage/pull.go:286:24: Error return value of `resolveProgressDone` is not checked (errcheck)
builder/builder-next/adapters/containerimage/pull.go:303:24: Error return value of `resolveProgressDone` is not checked (errcheck)
builder/builder-next/adapters/containerimage/pull.go:309:24: Error return value of `resolveProgressDone` is not checked (errcheck)
builder/builder-next/adapters/containerimage/pull.go:315:22: Error return value of `resolveProgressDone` is not checked (errcheck)
builder/builder-next/adapters/containerimage/pull.go:512:14: Error return value of `pw.Write` is not checked (errcheck)
builder/builder-next/adapters/containerimage/pull.go:675:13: Error return value of `pw.Write` is not checked (errcheck)
builder/builder-next/adapters/containerimage/pull.go:700:14: Error return value of `pw.Write` is not checked (errcheck)
builder/builder-next/adapters/containerimage/pull.go:786:10: Error return value of `pw.Write` is not checked (errcheck)
builder/builder-next/adapters/containerimage/pull.go:791:11: Error return value of `pw.Write` is not checked (errcheck)

builder/builder-next/exporter/export.go:133:13: Error return value of `layersDone` is not checked (errcheck)
builder/builder-next/exporter/export.go:163:12: Error return value of `configDone` is not checked (errcheck)
builder/builder-next/exporter/export.go:172:11: Error return value of `tagDone` is not checked (errcheck)
builder/builder-next/exporter/writer.go:207:10: Error return value of `pw.Write` is not checked (errcheck)
builder/builder-next/exporter/writer.go:212:11: Error return value of `pw.Write` is not checked (errcheck)
builder/builder-next/worker/worker.go:397:6: Error return value of `done` is not checked (errcheck)
builder/builder-next/worker/worker.go:446:10: Error return value of `pw.Write` is not checked (errcheck)
builder/builder-next/worker/worker.go:451:11: Error return value of `pw.Write` is not checked (errcheck)
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2019-08-28 17:42:47 +02:00
parent 4e621a34ac
commit e34c081354
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
4 changed files with 22 additions and 22 deletions

View file

@ -275,7 +275,7 @@ func (p *puller) resolve(ctx context.Context) error {
ref, err := distreference.ParseNormalizedNamed(p.src.Reference.String()) ref, err := distreference.ParseNormalizedNamed(p.src.Reference.String())
if err != nil { if err != nil {
p.resolveErr = err p.resolveErr = err
resolveProgressDone(err) _ = resolveProgressDone(err)
return return
} }
@ -283,7 +283,7 @@ func (p *puller) resolve(ctx context.Context) error {
origRef, desc, err := p.resolver.Resolve(ctx, ref.String()) origRef, desc, err := p.resolver.Resolve(ctx, ref.String())
if err != nil { if err != nil {
p.resolveErr = err p.resolveErr = err
resolveProgressDone(err) _ = resolveProgressDone(err)
return return
} }
@ -300,19 +300,19 @@ func (p *puller) resolve(ctx context.Context) error {
ref, err := distreference.WithDigest(ref, p.desc.Digest) ref, err := distreference.WithDigest(ref, p.desc.Digest)
if err != nil { if err != nil {
p.resolveErr = err p.resolveErr = err
resolveProgressDone(err) _ = resolveProgressDone(err)
return return
} }
_, dt, err := p.is.ResolveImageConfig(ctx, ref.String(), gw.ResolveImageConfigOpt{Platform: &p.platform, ResolveMode: resolveModeToString(p.src.ResolveMode)}, p.sm) _, dt, err := p.is.ResolveImageConfig(ctx, ref.String(), gw.ResolveImageConfigOpt{Platform: &p.platform, ResolveMode: resolveModeToString(p.src.ResolveMode)}, p.sm)
if err != nil { if err != nil {
p.resolveErr = err p.resolveErr = err
resolveProgressDone(err) _ = resolveProgressDone(err)
return return
} }
p.config = dt p.config = dt
} }
resolveProgressDone(nil) _ = resolveProgressDone(nil)
}) })
return p.resolveErr return p.resolveErr
} }
@ -509,7 +509,7 @@ func (p *puller) Snapshot(ctx context.Context) (cache.ImmutableRef, error) {
tm := time.Now() tm := time.Now()
end = &tm end = &tm
} }
pw.Write("extracting "+p.ID, progress.Status{ _ = pw.Write("extracting "+p.ID, progress.Status{
Action: "extract", Action: "extract",
Started: &st.st, Started: &st.st,
Completed: end, Completed: end,
@ -672,7 +672,7 @@ func showProgress(ctx context.Context, ongoing *jobs, cs content.Store, pw progr
refKey := remotes.MakeRefKey(ctx, j.Descriptor) refKey := remotes.MakeRefKey(ctx, j.Descriptor)
if a, ok := actives[refKey]; ok { if a, ok := actives[refKey]; ok {
started := j.started started := j.started
pw.Write(j.Digest.String(), progress.Status{ _ = pw.Write(j.Digest.String(), progress.Status{
Action: a.Status, Action: a.Status,
Total: int(a.Total), Total: int(a.Total),
Current: int(a.Offset), Current: int(a.Offset),
@ -685,7 +685,7 @@ func showProgress(ctx context.Context, ongoing *jobs, cs content.Store, pw progr
info, err := cs.Info(context.TODO(), j.Digest) info, err := cs.Info(context.TODO(), j.Digest)
if err != nil { if err != nil {
if containerderrors.IsNotFound(err) { if containerderrors.IsNotFound(err) {
// pw.Write(j.Digest.String(), progress.Status{ // _ = pw.Write(j.Digest.String(), progress.Status{
// Action: "waiting", // Action: "waiting",
// }) // })
continue continue
@ -697,7 +697,7 @@ func showProgress(ctx context.Context, ongoing *jobs, cs content.Store, pw progr
if done || j.done { if done || j.done {
started := j.started started := j.started
createdAt := info.CreatedAt createdAt := info.CreatedAt
pw.Write(j.Digest.String(), progress.Status{ _ = pw.Write(j.Digest.String(), progress.Status{
Action: "done", Action: "done",
Current: int(info.Size), Current: int(info.Size),
Total: int(info.Size), Total: int(info.Size),
@ -783,13 +783,13 @@ func oneOffProgress(ctx context.Context, id string) func(err error) error {
st := progress.Status{ st := progress.Status{
Started: &now, Started: &now,
} }
pw.Write(id, st) _ = pw.Write(id, st)
return func(err error) error { return func(err error) error {
// TODO: set error on status // TODO: set error on status
now := time.Now() now := time.Now()
st.Completed = &now st.Completed = &now
pw.Write(id, st) _ = pw.Write(id, st)
pw.Close() _ = pw.Close()
return err return err
} }
} }

View file

@ -130,7 +130,7 @@ func (e *imageExporterInstance) Export(ctx context.Context, inp exporter.Source)
diffs[i] = digest.Digest(diffIDs[i]) diffs[i] = digest.Digest(diffIDs[i])
} }
layersDone(nil) _ = layersDone(nil)
} }
if len(config) == 0 { if len(config) == 0 {
@ -160,7 +160,7 @@ func (e *imageExporterInstance) Export(ctx context.Context, inp exporter.Source)
if err != nil { if err != nil {
return nil, configDone(err) return nil, configDone(err)
} }
configDone(nil) _ = configDone(nil)
if e.opt.ReferenceStore != nil { if e.opt.ReferenceStore != nil {
for _, targetName := range e.targetNames { for _, targetName := range e.targetNames {
@ -169,7 +169,7 @@ func (e *imageExporterInstance) Export(ctx context.Context, inp exporter.Source)
if err := e.opt.ReferenceStore.AddTag(targetName, digest.Digest(id), true); err != nil { if err := e.opt.ReferenceStore.AddTag(targetName, digest.Digest(id), true); err != nil {
return nil, tagDone(err) return nil, tagDone(err)
} }
tagDone(nil) _ = tagDone(nil)
} }
} }

View file

@ -204,13 +204,13 @@ func oneOffProgress(ctx context.Context, id string) func(err error) error {
st := progress.Status{ st := progress.Status{
Started: &now, Started: &now,
} }
pw.Write(id, st) _ = pw.Write(id, st)
return func(err error) error { return func(err error) error {
// TODO: set error on status // TODO: set error on status
now := time.Now() now := time.Now()
st.Completed = &now st.Completed = &now
pw.Write(id, st) _ = pw.Write(id, st)
pw.Close() _ = pw.Close()
return err return err
} }
} }

View file

@ -394,7 +394,7 @@ func (ld *layerDescriptor) Download(ctx context.Context, progressOutput pkgprogr
if err := contentutil.Copy(ctx, ld.w.ContentStore, ld.provider, ld.desc); err != nil { if err := contentutil.Copy(ctx, ld.w.ContentStore, ld.provider, ld.desc); err != nil {
return nil, 0, done(err) return nil, 0, done(err)
} }
done(nil) _ = done(nil)
ra, err := ld.w.ContentStore.ReaderAt(ctx, ld.desc) ra, err := ld.w.ContentStore.ReaderAt(ctx, ld.desc)
if err != nil { if err != nil {
@ -443,13 +443,13 @@ func oneOffProgress(ctx context.Context, id string) func(err error) error {
st := progress.Status{ st := progress.Status{
Started: &now, Started: &now,
} }
pw.Write(id, st) _ = pw.Write(id, st)
return func(err error) error { return func(err error) error {
// TODO: set error on status // TODO: set error on status
now := time.Now() now := time.Now()
st.Completed = &now st.Completed = &now
pw.Write(id, st) _ = pw.Write(id, st)
pw.Close() _ = pw.Close()
return err return err
} }
} }