importSpec returns the import spec if f imports path, or nil otherwise.
(f *ast.File, path string)
| 290 | // importSpec returns the import spec if f imports path, |
| 291 | // or nil otherwise. |
| 292 | func importSpec(f *ast.File, path string) *ast.ImportSpec { |
| 293 | for _, s := range f.Imports { |
| 294 | if importPath(s) == path { |
| 295 | return s |
| 296 | } |
| 297 | } |
| 298 | return nil |
| 299 | } |
| 300 | |
| 301 | // importPath returns the unquoted import path of s, |
| 302 | // or "" if the path is not properly quoted. |
no test coverage detected