We have a project written in Go lang(go1.19.2) and sonar scanning is failing with the following error:
ERROR: Unable to parse file: file:///builds/example///.go.
382ERROR: Cannot parse ‘com/example//’: Go parser external process returned non-zero exit value: 2
Without the file in question, it won’t be obvious what’s causing the issue. And, SonarQube v8.9 LTS only supports up Go v1.15, which was the version released at the time. SonarQube v9.7 should support up to Go v1.19.
ERROR: Unable to parse file: file:///builds/pearsontechnology/gpt/cls/dos/dos-mds-data-retriever-lambda/com/pearson/dos/lambda/util/Unmarshaller.go.
382ERROR: Cannot parse ‘com/pearson/dos/lambda/util/Unmarshaller.go’: Go parser external process returned non-zero exit value: 2
383ERROR: Unable to parse file: file:///builds/pearsontechnology/gpt/cls/dos/dos-mds-data-retriever-lambda/com/pearson/dos/lambda/service/PiTokenService.go.
384ERROR: Cannot parse ‘com/pearson/dos/lambda/service/PiTokenService.go’: Go parser external process returned non-zero exit value: 2
385ERROR: Unable to parse file: file:///builds/pearsontechnology/gpt/cls/dos/dos-mds-data-retriever-lambda/com/pearson/dos/lambda/repo/MdsRepository.go.
386ERROR: Cannot parse ‘com/pearson/dos/lambda/repo/MdsRepository.go’: Go parser external process returned non-zero exit value: 2
387ERROR: Unable to parse file: file:///builds/pearsontechnology/gpt/cls/dos/dos-mds-data-retriever-lambda/com/pearson/dos/lambda/repo/PiTokenRepository.go.
388ERROR: Cannot parse ‘com/pearson/dos/lambda/repo/PiTokenRepository.go’: Go parser external process returned non-zero exit value: 2
389ERROR: Unable to parse file: file:///builds/pearsontechnology/gpt/cls/dos/dos-mds-data-retriever-lambda/com/pearson/dos/lambda/core/Runner.go.
390ERROR: Cannot parse ‘com/pearson/dos/lambda/core/Runner.go’: Go parser external process returned non-zero exit value: 2
Second, to determine if the parsing error is the result of newer syntax that SonarQube v8.9 LTS doesn’t support… you would have to share the file (as noted in my last response). And, it’s really likely that you face what I mentioned before.
Apologies, I did not mean to bump the threads. I am actively following up on this issue reported by Rupitha and the most recent update from our user, Imteyaz Ahmad, is:
If the code uses generics, introduced in Go 1.18 – then I think everything I’ve posted already sums it up! Go 1.18 syntax isn’t supported in SonarQube v8.9 LTS, it is supported in the latest v9.x versions (and will be supported in v9.x LTS, targeted for Q1 2023.