Go support in Visual Studio Code

SonarLint seems to be a great tool, and the integration in Visual Studio Code seems similarly very useful.

Is there a plan to support linting Go code in SonarLint for Visual Studio Code?

Thanks!

I’ve looked in JIRA and there doesn’t seem to be any mention of the idea.

Is it as simple as adding a few lines to scripts/prepare.js and src/extension.ts?

Looks like no … I’ve made what I think are the required changes to those files and still get: ```
Available languages:

  • PHP => “php”
  • Python => “py”
  • TypeScript => “ts”
  • JavaScript => “js”

Aha:

[Warn - 1:41:02 PM] Code analyzer ‘SonarGo’ is not compatible with SonarLint. Skip loading it.

Hi Geoff,

Indeed, the Go analyzer is yet not compatible with SonarLint.
Currently, there’s no short-term plan to work on this, but it might come later.

Thanks @Chris! How would someone learn what changes would be required to make the Go analyzer compatible with SonarLint? Any idea how big a project that might be?

Are the relevant projects sonarlint-core and sonar-go?


Hi @glb

You can have a look at this two PRs I did recently to add support for Kotlin and Ruby

https://github.com/SonarSource/slang/pull/211/files
https://github.com/SonarSource/sonarlint-core/pull/222

However, the main part of the work is not technical one, but in testing. Also you will need to modify specific SonarLint IDE plugin for which you want to make it work (VSCode, IntelliJ, Atom, Eclipse)

Also just be warned, we are quite busy, so even if you make the contribution I can not guarantee that we will be able to review it and integrate it in timely manner. Of course you can build and use it for yourself locally.

1 Like

Thank you @saberduck! I will definitely take a look at these. I think I’ve got the changes I need for the VSCode extension, the next step seems to be to resolve the Code analyzer 'SonarGo' is not compatible with SonarLint issue. Hopefully these PRs will be enough to get things working enough to try it out.

Thanks very much!

@glb I created a ticket to keep track of this request https://github.com/SonarSource/sonar-go/issues/343

1 Like

Thanks @saberduck! I wasn’t able to resolve the issues I encountered trying to do this myself so I gave up (temporarily?) … am definitely looking forward to seeing go support happen.

Would be great if GoLang were supported in all SonarLint variants (in our company we use IntelliJ IDEA mostly, and some Eclipse). I wonder if I should open a separate ticket for that…

+1 we are looking forward to GoLang support for VSCode and the IntelliJ based IDEs.

+1 in our project we also need SonarLint for VS Code

@saberduck https://github.com/SonarSource/sonar-go/issues/343 has been archived with no information about the new hosting location. Do you have an update on this issue, we get a lot of requests for this internally.

Hello,
the new ticket tracking the SonarLint support for GO analyser is here: https://jira.sonarsource.com/projects/SONARSLANG/issues/SONARSLANG-438. Please note that it is not in our short-term roadmap, and there are both functional and technical challenges to be solved which make this ticket a non-trivial one to implement. In all cases, if we see an increasing interest for GO language among SonarLint users, we will reconsider our prioritisation.

+1 for SonarLint GO support in IntelliJ

Is Sonarlint GoSupport been activated on VS Code ?
If not, is there a manual way to make it work on vscode ?

Thank You

Hi,

Go analysis is still not available in SonarLint. We will definitely update this thread if the situation would change.

1 Like

@Julien_HENRY any input on the hold up? There are a lot of folks that would love to see Go support in SonarLint.I understand it requires to write some code but considering SonarLint is already supporting other languages, an other one should be a fairly generic change. I think it would be a small effort to benefit many paying customers.

2 Likes

+1 for SonarLint GO support

1 Like