public String[] getPackageImports() {
List<String> packageImports = new ArrayList<String>();
for (GoImportDeclaration importSpec : imports) {
GoPackageReference packageReference = importSpec.getPackageReference();
if (packageReference == null) {
// If there is no package reference but the import path contains
// a ".', treat it like a package reference were specfied.
GoLiteralString importPath = importSpec.getImportPath();
if (importPath != null) {
String path = importPath.getValue();
if (isDotImport(path)) {
path = findDefaultPackageName(path);
}
packageImports.add(path);
}
continue;
}
if (packageReference.isLocal() || packageReference.isBlank()) {
continue;
}
packageImports.add(packageReference.getString());
}
return packageImports.toArray(new String[packageImports.size()]);
}