Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

Commit 7f0ac2f

Browse files
committed
Fix staticcheck errors
1 parent 7d21ee7 commit 7f0ac2f

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

cmd/dep/ensure.go

+8-5
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ func (cmd *ensureCommand) runAdd(ctx *dep.Ctx, args []string, p *dep.Project, sm
574574
Source: instr.id.Source,
575575
Constraint: instr.constraint,
576576
}
577-
} else {
577+
//} else {
578578
// TODO(sdboyer) hoist a constraint into the manifest from the lock
579579
}
580580
}
@@ -586,12 +586,15 @@ func (cmd *ensureCommand) runAdd(ctx *dep.Ctx, args []string, p *dep.Project, sm
586586
sort.Strings(reqlist)
587587

588588
sw, err := dep.NewSafeWriter(nil, p.Lock, dep.LockFromSolution(solution), dep.VendorOnChanged)
589+
if err != nil {
590+
return err
591+
}
592+
589593
if cmd.dryRun {
590594
return sw.PrintPreparedActions(ctx.Out)
591595
}
592596

593-
err = errors.Wrap(sw.Write(p.AbsRoot, sm, true), "grouped write of manifest, lock and vendor")
594-
if err != nil {
597+
if err := errors.Wrap(sw.Write(p.AbsRoot, sm, true), "grouped write of manifest, lock and vendor"); err != nil {
595598
return err
596599
}
597600

@@ -601,8 +604,8 @@ func (cmd *ensureCommand) runAdd(ctx *dep.Ctx, args []string, p *dep.Project, sm
601604
return errors.Wrapf(err, "opening %s failed", dep.ManifestName)
602605
}
603606

604-
_, err = f.Write(extra)
605-
if err != nil {
607+
if _, err := f.Write(extra); err != nil {
608+
f.Close()
606609
return errors.Wrapf(err, "writing to %s failed", dep.ManifestName)
607610
}
608611

0 commit comments

Comments
 (0)