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

Commit

Permalink
Fix staticcheck errors, license
Browse files Browse the repository at this point in the history
  • Loading branch information
sdboyer committed Aug 3, 2017
1 parent 7d21ee7 commit b8f7027
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
13 changes: 8 additions & 5 deletions cmd/dep/ensure.go
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ func (cmd *ensureCommand) runAdd(ctx *dep.Ctx, args []string, p *dep.Project, sm
Source: instr.id.Source,
Constraint: instr.constraint,
}
} else {
//} else {
// TODO(sdboyer) hoist a constraint into the manifest from the lock
}
}
Expand All @@ -586,12 +586,15 @@ func (cmd *ensureCommand) runAdd(ctx *dep.Ctx, args []string, p *dep.Project, sm
sort.Strings(reqlist)

sw, err := dep.NewSafeWriter(nil, p.Lock, dep.LockFromSolution(solution), dep.VendorOnChanged)
if err != nil {
return err
}

if cmd.dryRun {
return sw.PrintPreparedActions(ctx.Out)
}

err = errors.Wrap(sw.Write(p.AbsRoot, sm, true), "grouped write of manifest, lock and vendor")
if err != nil {
if err := errors.Wrap(sw.Write(p.AbsRoot, sm, true), "grouped write of manifest, lock and vendor"); err != nil {
return err
}

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

_, err = f.Write(extra)
if err != nil {
if _, err := f.Write(extra); err != nil {
f.Close()
return errors.Wrapf(err, "writing to %s failed", dep.ManifestName)
}

Expand Down
4 changes: 4 additions & 0 deletions cmd/dep/ensure_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import (
Expand Down

0 comments on commit b8f7027

Please sign in to comment.