Intellij: Golang: Out of Sync / right-click test configurations

Created on 17 Jan 2018  路  10Comments  路  Source: bazelbuild/intellij

Versions: IDEA Ultimate 2017.3.3 / 2018.01.02.0.1
          IDEA Ultimate 2017.3.1 / 2017.11.20.0.4

We are missing the right-click Run/Debug options in Golang projects that we have for Java/Scala.

We can execute tests form the corresponding BUILD file, but not from the context of the test file itself either as a whole unit or an individual method.

It also appears that the Workspace is frequently out-of-sync (via the light in the toolbar).

Sample .bazelproject:

directories:
  .

targets:
  //...

additional_languages:
  go

I am interesting in contributing, would we just need to port somethings over from the Java/Scala invocations?

go

Most helpful comment

We're in discussions with the Skylark folks now to come up with a solution for this (likely adding support for a conditional load).

The only reason our plugin currently works for java-like languages (java, scala, kotlin) is that the java providers we use are bundled with Bazel. This is something we're going to have to solve for all languages.

All 10 comments

You don't see these from right clicking?
screenshot from 2018-01-17 14-30-58
screenshot from 2018-01-17 14-31-28

Can you share your project? Or a minimal repro case?

Thanks for the reply @chaoren, yeah I am missing those options. Let me see if I can create a reproducible example outside our private monorepo context.

@chaoren, here is one of our public projects that I was able to repro the issue with:
https://github.com/vsco/domino

I setup the project via:

  • Import Bazel Proejct
  • Use existing workspace (GOPATH to repo)
  • Create project view from scratch (using above)
  • Re-syncing project / allow indexing to complete

Via TestGetItemEmpty:
screen shot 2018-01-17 at 2 41 57 pm

Via BUILD
screen shot 2018-01-17 at 2 40 20 pm

Problem seems to be in rules_go.
ctx.rule.attr is empty for go_test targets.

Thank you @chaoren 馃憤 !

Bad news. Those providers are not usable unless we load their definitions from the rules_go repo into our aspect, but we also run the aspect for non-go workspaces, and there's no such thing as a conditional load. We'll need to talk with the bazel people about potentially changing the providers API.

Is the rules_go project the only one that is not following the same convention for those providers? It would seem that in that case if let's say rules_scala made a similar change we would lose functionality there as well right?

We're in discussions with the Skylark folks now to come up with a solution for this (likely adding support for a conditional load).

The only reason our plugin currently works for java-like languages (java, scala, kotlin) is that the java providers we use are bundled with Bazel. This is something we're going to have to solve for all languages.

It works as of the latest plugin and IDE.

Was this page helpful?
0 / 5 - 0 ratings