diff --git a/pkg/testutils/lint/lint_test.go b/pkg/testutils/lint/lint_test.go index 58df525be308..ee6450fe6aa3 100644 --- a/pkg/testutils/lint/lint_test.go +++ b/pkg/testutils/lint/lint_test.go @@ -1629,12 +1629,19 @@ func TestLint(t *testing.T) { pkgs, err := packages.Load( &packages.Config{ Mode: packages.NeedImports | packages.NeedName, + Dir: crdbDir, }, pkgPath, ) if err != nil { return errors.Wrapf(err, "error loading package %s", pkgPath) } + // NB: if no packages were found, this API confusingly + // returns no error, so we need to explicitly check that + // something was returned. + if len(pkgs) == 0 { + return errors.Newf("could not list packages under %s", pkgPath) + } for _, pkg := range pkgs { for _, s := range pkg.Imports { arg.Out <- pkg.PkgPath + ": " + s.PkgPath @@ -1666,6 +1673,7 @@ func TestLint(t *testing.T) { stream.GrepNot(`cockroachdb/cockroach/pkg/kv/kvpb/gen: log$`), stream.GrepNot(`cockroachdb/cockroach/pkg/util/log/gen: log$`), stream.GrepNot(`cockroach/pkg/util/uuid: github\.com/satori/go\.uuid$`), + stream.GrepNot(`github.com/cockroachdb/cockroach/pkg/workload/debug: log$`), ), func(s string) { pkgStr := strings.Split(s, ": ") importingPkg, importedPkg := pkgStr[0], pkgStr[1]