private static boolean allowed(@NotNull GoNamedElement element) { GoFile file = element.getContainingFile(); if (GoPsiImplUtil.builtin(element) || !GoUtil.allowed(file) || GoUtil.isExcludedFile(file)) return false; PsiDirectory directory = file.getContainingDirectory(); if (directory != null) { VirtualFile vFile = directory.getVirtualFile(); if (vFile.getPath().endsWith("go/doc/testdata")) return false; } if (StringUtil.equals(file.getPackageName(), GoConstants.MAIN)) return false; return true; }
@NotNull private ExistingImportData cachedImportData( @NotNull GoNamedElement element, @Nullable ExistingImportData existingValue) { if (existingValue != null) return existingValue; GoFile declarationFile = element.getContainingFile(); String importPath = declarationFile.getImportPath(); GoImportSpec existingImport = myImportedPackages.get(importPath); boolean exists = existingImport != null; boolean isDot = exists && existingImport.isDot(); String alias = existingImport != null ? existingImport.getAlias() : null; return new ExistingImportData(exists, isDot, alias, importPath); }