Golang parsing error with hex integer literal with underscores

I’m using the gradle sonarqube plugin 3.1.1 for a golang project. One file contained a hex integer literal with some underscores, which is valid as of https://golang.org/ref/spec#Integer_literals and which worked in all other tools. The sonarqube task did however log:

Unable to parse file: file://.......go. 
Parser returned non-zero exit value: 2

After that it just had no data for that file but still showed the file in the web UI. It would have been helpful if this would have caused an error and if it would have given some more information at what point in the file the parsing error occurred. Beside that it would of course have been nice if the parse would be able to parse spec compliant files :wink:

Hello @HendrikH,

I agree that the experience in the case of parsing error is not ideal. In fact, it is due to the fact that we rely on the native Go parser to parse the code, and that it is not trivial in our context to recover more details.

In any way, we updated the version of the parser used a few months ago already, I just tested and hex literals with underscores are correctly supported.

It is already available for SonarCloud, and SonarQube 8.6.


Hi @Quentin,

thanks for the quick response and checking this on the latest version!
Will check if we can get our version updated then.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.