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

Commit

Permalink
Simplify some more code
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdan committed Dec 12, 2016
1 parent c3698c2 commit e5cfab5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions check.go
Expand Up @@ -120,10 +120,6 @@ type visitor struct {
// passing its import path and the warnings found. Returns an error, if
// any.
func CheckArgs(args []string, onWarns func(string, []Warn)) error {
wd, err := os.Getwd()
if err != nil {
return err
}
paths := gotool.ImportPaths(args)
c := newCache()
rest, err := c.FromArgs(paths, false)
Expand All @@ -143,9 +139,11 @@ func CheckArgs(args []string, onWarns func(string, []Warn)) error {
}
v := &visitor{
cache: c,
wd: wd,
fset: prog.Fset,
}
if v.wd, err = os.Getwd(); err != nil {
return err
}
for _, pkg := range pkgs {
c.grabNames(pkg)
warns := v.checkPkg(prog.AllPackages[pkg])
Expand Down
2 changes: 1 addition & 1 deletion generate/std/main.go
Expand Up @@ -179,6 +179,6 @@ func main() {
}

func errExit(err error) {
fmt.Fprintf(os.Stderr, "%v\n", err)
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}

0 comments on commit e5cfab5

Please sign in to comment.