@Override
    public void run() {
      Project project = myModule.getProject();
      if (GoSdkService.getInstance(project).isGoModule(myModule)) {
        synchronized (myLastHandledGoPathSourcesRoots) {
          Collection<VirtualFile> goPathSourcesRoots =
              GoSdkUtil.getGoPathSources(project, myModule);
          Set<VirtualFile> excludeRoots =
              ContainerUtil.newHashSet(ProjectRootManager.getInstance(project).getContentRoots());
          ProgressIndicatorProvider.checkCanceled();
          if (!myLastHandledGoPathSourcesRoots.equals(goPathSourcesRoots)
              || !myLastHandledExclusions.equals(excludeRoots)) {
            Collection<VirtualFile> includeRoots =
                gatherIncludeRoots(goPathSourcesRoots, excludeRoots);
            ApplicationManager.getApplication()
                .invokeLater(
                    () -> {
                      if (!myModule.isDisposed()
                          && GoSdkService.getInstance(project).isGoModule(myModule)) {
                        attachLibraries(includeRoots, excludeRoots);
                      }
                    });

            myLastHandledGoPathSourcesRoots.clear();
            myLastHandledGoPathSourcesRoots.addAll(goPathSourcesRoots);

            myLastHandledExclusions.clear();
            myLastHandledExclusions.addAll(excludeRoots);

            List<String> paths = ContainerUtil.map(goPathSourcesRoots, VirtualFile::getPath);
            myWatchedRequests.clear();
            myWatchedRequests.addAll(LocalFileSystem.getInstance().addRootsToWatch(paths, true));
          }
        }
      } else {
        synchronized (myLastHandledGoPathSourcesRoots) {
          LocalFileSystem.getInstance().removeWatchedRoots(myWatchedRequests);
          myLastHandledGoPathSourcesRoots.clear();
          myLastHandledExclusions.clear();
          ApplicationManager.getApplication()
              .invokeLater(
                  () -> {
                    if (!myModule.isDisposed()
                        && GoSdkService.getInstance(project).isGoModule(myModule)) {
                      removeLibraryIfNeeded();
                    }
                  });
        }
      }
    }
  private void showVendoringNotification() {
    if (!myModuleInitialized || myModule.isDisposed()) {
      return;
    }
    Project project = myModule.getProject();
    String version = GoSdkService.getInstance(project).getSdkVersion(myModule);
    if (!GoVendoringUtil.supportsVendoring(version)
        || GoVendoringUtil.supportsVendoringByDefault(version)) {
      return;
    }
    if (GoModuleSettings.getInstance(myModule).getVendoringEnabled() != ThreeState.UNSURE) {
      return;
    }

    PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(project);
    boolean shownAlready;
    //noinspection SynchronizationOnLocalVariableOrMethodParameter
    synchronized (propertiesComponent) {
      shownAlready =
          propertiesComponent.getBoolean(GO_VENDORING_NOTIFICATION_HAD_BEEN_SHOWN, false);
      if (!shownAlready) {
        propertiesComponent.setValue(
            GO_VENDORING_NOTIFICATION_HAD_BEEN_SHOWN, String.valueOf(true));
      }
    }

    if (!shownAlready) {
      NotificationListener.Adapter notificationListener =
          new NotificationListener.Adapter() {
            @Override
            protected void hyperlinkActivated(
                @NotNull Notification notification, @NotNull HyperlinkEvent event) {
              if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED
                  && "configure".equals(event.getDescription())) {
                GoModuleSettings.showModulesConfigurable(project);
              }
            }
          };
      Notification notification =
          GoConstants.GO_NOTIFICATION_GROUP.createNotification(
              "Vendoring usage is detected",
              "<p><strong>vendor</strong> directory usually means that project uses Go Vendor Experiment.</p>\n"
                  + "<p>Selected Go SDK version support vendoring but it's disabled by default.</p>\n"
                  + "<p>You may want to explicitly enabled Go Vendor Experiment in the <a href='configure'>project settings</a>.</p>",
              NotificationType.INFORMATION,
              notificationListener);
      Notifications.Bus.notify(notification, project);
    }
  }
  public GoBuildTargetConfigurable(@NotNull Project project, boolean dialogMode) {
    if (dialogMode) {
      myPanel.setPreferredSize(new Dimension(400, -1));
    }

    myBuildTargetSettings = GoBuildTargetSettings.getInstance(project);

    myDefaultOSValue = "Default (" + GoUtil.systemOS() + ")";
    myDefaultArchValue = "Default (" + GoUtil.systemArch() + ")";
    myDefaultGoVersion =
        "Project SDK ("
            + StringUtil.notNullize(GoSdkService.getInstance(project).getSdkVersion(null), "any")
            + ")";
    myDefaultCgo = "Default (" + cgo(GoUtil.systemCgo(myDefaultOSValue, myDefaultArchValue)) + ")";

    myOSCombo.setModel(createModel(GoConstants.KNOWN_OS, myDefaultOSValue));
    myArchCombo.setModel(createModel(GoConstants.KNOWN_ARCH, myDefaultArchValue));
    myCgoComboModel = createModel(ContainerUtil.newArrayList(ENABLED, DISABLED), myDefaultCgo);
    myCgoCombo.setModel(myCgoComboModel);
    myCompilerCombo.setModel(
        createModel(GoConstants.KNOWN_COMPILERS, GoBuildTargetSettings.ANY_COMPILER));
    myGoVersionCombo.setModel(createModel(GoConstants.KNOWN_VERSIONS, myDefaultGoVersion));

    ActionListener updateCgoListener =
        new ActionListener() {
          @Override
          public void actionPerformed(@NotNull ActionEvent event) {
            String selected = StringUtil.notNullize(myCgoComboModel.getSelected(), myDefaultCgo);
            String oldDefault = myDefaultCgo;
            String os = expandDefault(selected(myOSCombo, myDefaultOSValue), GoUtil.systemOS());
            String arch =
                expandDefault(selected(myArchCombo, myDefaultArchValue), GoUtil.systemArch());

            myDefaultCgo = "Default (" + cgo(GoUtil.systemCgo(os, arch)) + ")";
            myCgoComboModel.update(ContainerUtil.newArrayList(myDefaultCgo, ENABLED, DISABLED));
            myCgoComboModel.setSelectedItem(oldDefault.equals(selected) ? myDefaultCgo : selected);
          }
        };
    myOSCombo.addActionListener(updateCgoListener);
    myArchCombo.addActionListener(updateCgoListener);
  }