@@ -35,7 +35,7 @@ func (s *solver) check(a atomWithPackages, pkgonly bool) error {
35
35
}
36
36
}
37
37
38
- if err = s .checkRequiredPackagesExist (a ); err != nil {
38
+ if err = s .checkImportRequirementsAreValid (a ); err != nil {
39
39
return err
40
40
}
41
41
@@ -100,9 +100,9 @@ func (s *solver) checkAtomAllowable(pa atom) error {
100
100
return err
101
101
}
102
102
103
- // checkRequiredPackagesExist ensures that all required packages enumerated by
103
+ // checkImportRequirementsAreValid ensures that all required packages enumerated by
104
104
// existing dependencies on this atom are actually present in the atom.
105
- func (s * solver ) checkRequiredPackagesExist (a atomWithPackages ) error {
105
+ func (s * solver ) checkImportRequirementsAreValid (a atomWithPackages ) error {
106
106
ptree , err := s .b .ListPackages (a .a .id , a .a .v )
107
107
if err != nil {
108
108
// TODO(sdboyer) handle this more gracefully
@@ -121,11 +121,24 @@ func (s *solver) checkRequiredPackagesExist(a atomWithPackages) error {
121
121
fp [pkg ] = errdep
122
122
} else {
123
123
perr , has := ptree .Packages [pkg ]
124
- if ! has || perr .Err != nil {
124
+ switch {
125
+ case ! has :
126
+ fallthrough
127
+ case perr .Err != nil :
125
128
fp [pkg ] = errDeppers {
126
129
err : perr .Err ,
127
130
deppers : []atom {dep .depender },
128
131
}
132
+ case perr .P .CommentPath != "" && pkg != perr .P .CommentPath :
133
+ // we have the package, but depender is trying to import it
134
+ // via non-canonical import path, so croak about it
135
+ fp [pkg ] = errDeppers {
136
+ err : & canonicalImportPathFailure {
137
+ actual : pkg ,
138
+ canonical : perr .P .CommentPath ,
139
+ },
140
+ deppers : []atom {dep .depender },
141
+ }
129
142
}
130
143
}
131
144
}
0 commit comments