Correctly identify and ignore package C.
This addresses #82. While we were identifying the package before, we
were not properly filtering it at the right locations. This fix
changes tree, list, and guess to filter the C package correctly.
diff --git a/cmd/guess_deps.go b/cmd/guess_deps.go
index 53c8ab7..15735c4 100644
--- a/cmd/guess_deps.go
+++ b/cmd/guess_deps.go
@@ -54,12 +54,17 @@
return err
}
+ // Skip cgo pseudo-package.
+ if name == "C" {
+ return nil
+ }
+
pkg, err := b.Import(name, cwd, 0)
if err != nil {
return err
}
- if pkg.Goroot || name == "C" {
+ if pkg.Goroot {
return nil
}
diff --git a/cmd/tree.go b/cmd/tree.go
index 6ec2043..39d4d8c 100644
--- a/cmd/tree.go
+++ b/cmd/tree.go
@@ -85,7 +85,7 @@
case ptypeUnknown:
info[name] = false
break
- case ptypeGoroot:
+ case ptypeGoroot, ptypeCgo:
break
default:
info[name] = true
@@ -104,7 +104,7 @@
fmt.Printf("\t%s\t(%s)\n", found.Name, msg)
continue
}
- if !core && found.PType == ptypeGoroot {
+ if !core && found.PType == ptypeGoroot || found.PType == ptypeCgo {
continue
}
fmt.Print(strings.Repeat("\t", level))