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

Commit b8f7027

Browse files
committed
Fix staticcheck errors, license
1 parent 7d21ee7 commit b8f7027

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-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

cmd/dep/ensure_test.go

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2016 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
15
package main
26

37
import (

0 commit comments

Comments
 (0)