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

allow dirs that don't contain go files (fix #1306) #1398

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
["init", "-no-examples", "-skip-tools"],
["ensure", "-update"]
],
"error-expected": "no dirs contained any Go code",
"error-expected": "",
"vendor-final": []
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"commands": [
["ensure"]
],
"error-expected": "found 1 errors",
"error-expected": "",
"vendor-final": []
}
4 changes: 0 additions & 4 deletions gps/pkgtree/pkgtree.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,6 @@ func fillPackage(p *build.Package) error {
return err
}

if len(gofiles) == 0 {
return &build.NoGoError{Dir: p.Dir}
}

var testImports []string
var imports []string
var importComments []string
Expand Down
20 changes: 9 additions & 11 deletions gps/pkgtree/pkgtree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package pkgtree

import (
"fmt"
"go/build"
"go/scanner"
"go/token"
"io/ioutil"
Expand Down Expand Up @@ -489,8 +488,9 @@ func TestListPackages(t *testing.T) {
ImportRoot: "empty",
Packages: map[string]PackageOrErr{
"empty": {
Err: &build.NoGoError{
Dir: j("empty"),
P: Package{
ImportPath: "empty",
Imports: []string{},
},
},
},
Expand Down Expand Up @@ -733,8 +733,9 @@ func TestListPackages(t *testing.T) {
ImportRoot: "ren",
Packages: map[string]PackageOrErr{
"ren": {
Err: &build.NoGoError{
Dir: j("ren"),
P: Package{
ImportPath: "ren",
Imports: []string{},
},
},
"ren/m1p": {
Expand Down Expand Up @@ -1653,8 +1654,9 @@ func TestListPackagesNoPerms(t *testing.T) {
ImportRoot: "ren",
Packages: map[string]PackageOrErr{
"ren": {
Err: &build.NoGoError{
Dir: workdir,
P: Package{
ImportPath: "ren",
Imports: []string{},
},
},
"ren/m1p": {
Expand Down Expand Up @@ -1690,10 +1692,6 @@ func TestListPackagesNoPerms(t *testing.T) {
}
}

if got.Packages["ren"].Err == nil {
t.Error("Should have gotten error on empty root directory")
}

if !reflect.DeepEqual(got.Packages["ren/m1p"].P.Imports, want.Packages["ren/m1p"].P.Imports) {
t.Error("Mismatch between imports in m1p")
}
Expand Down