Skip to content

Commit

Permalink
#155 - Fix compilation errors after rebasing from upstream/master
Browse files Browse the repository at this point in the history
  • Loading branch information
coopernurse committed Dec 28, 2018
1 parent ad0da2e commit 4c22418
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
5 changes: 2 additions & 3 deletions internal/errcheck/errcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"strings"
"sync"

"go/parser"
"golang.org/x/tools/go/packages"
)

Expand Down Expand Up @@ -374,14 +373,14 @@ func (v *visitor) namesForExcludeCheck(call *ast.CallExpr) []string {
func (v *visitor) argName(expr ast.Expr) string {
// Special-case literal "os.Stdout" and "os.Stderr"
if sel, ok := expr.(*ast.SelectorExpr); ok {
if obj := v.pkg.ObjectOf(sel.Sel); obj != nil {
if obj := v.pkg.TypesInfo.ObjectOf(sel.Sel); obj != nil {
vr, ok := obj.(*types.Var)
if ok && vr.Pkg() != nil && vr.Pkg().Name() == "os" && (vr.Name() == "Stderr" || vr.Name() == "Stdout") {
return "os." + vr.Name()
}
}
}
t := v.pkg.Info.TypeOf(expr)
t := v.pkg.TypesInfo.TypeOf(expr)
if t == nil {
return ""
}
Expand Down
1 change: 0 additions & 1 deletion internal/errcheck/errcheck_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ func init() {
cfg := &packages.Config{
Mode: packages.LoadSyntax,
Tests: true,
Error: func(error) {}, // don't print type check errors
}
pkgs, err := packages.Load(cfg, testPackage)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestMain(t *testing.T) {
t.Errorf("Exit code is %d, expected %d", exitCode, exitUncheckedError)
}

expectUnchecked := 28
expectUnchecked := 29
if got := strings.Count(out, "UNCHECKED"); got != expectUnchecked {
t.Errorf("Got %d UNCHECKED errors, expected %d in:\n%s", got, expectUnchecked, out)
}
Expand Down

0 comments on commit 4c22418

Please sign in to comment.