private static boolean hasImportUsers(@NotNull GoImportSpec spec) {
   //noinspection SynchronizationOnLocalVariableOrMethodParameter
   synchronized (spec) {
     List<PsiElement> list = spec.getUserData(GoReferenceBase.IMPORT_USERS);
     if (list != null) {
       for (PsiElement e : list) {
         if (e.isValid()) {
           return true;
         }
         ProgressManager.checkCanceled();
       }
     }
   }
   return false;
 }
  private static void deleteImportSpec(@Nullable GoImportSpec importSpec) {
    GoImportDeclaration importDeclaration =
        PsiTreeUtil.getParentOfType(importSpec, GoImportDeclaration.class);
    if (importSpec != null && importDeclaration != null) {
      PsiElement startElementToDelete = importSpec;
      PsiElement endElementToDelete = importSpec;
      if (importDeclaration.getImportSpecList().size() == 1) {
        startElementToDelete = importDeclaration;
        endElementToDelete = importDeclaration;

        PsiElement nextSibling = endElementToDelete.getNextSibling();
        if (nextSibling != null && nextSibling.getNode().getElementType() == GoTypes.SEMICOLON) {
          endElementToDelete = nextSibling;
        }
      }
      // todo: delete after proper formatter implementation
      PsiElement nextSibling = endElementToDelete.getNextSibling();
      if (nextSibling instanceof PsiWhiteSpace && nextSibling.textContains('\n')) {
        endElementToDelete = nextSibling;
      }
      startElementToDelete.getParent().deleteChildRange(startElementToDelete, endElementToDelete);
    }
  }