SONAR-scanner can't file index .go in win10


(Weijian Ni) #1

SonarQube 7.2.1
SonarQube Scanner
Java 1.8.0_121 Oracle Corporation (64-bit)
Windows 10 10.0 amd64
go version go1.10.3 windows/amd64


 sonar.projectName=Fisrt Test

When I run sonar-scanner.bat

0 files indexed

How can I do this?

(Tibor Blenessy) #2


your sonar.inclusions property should be like **/*.go , to allow indexing Go source files in subdirectories. Same for sonar.exclusions

(Tibor Blenessy) #3

Sorry, I noticed on the screenshot that you are actually setting the properties the way I suggest, it was only improperly formatted in your message.

Can you post your actual directory structure?

(Weijian Ni) #4

thank for you reply

$ pwd

$ ls
duration.go       extension_test.go  offset_test.go            testdata/
duration_test.go  LICENSE                   vast.go
extension.go      offset.go  vast_test.go

I guess the dir path can’t has the name VENDOR.

(Nicolas Bontoux) #5

There isn’t any such restriction. I would recommend getting debug logs (sonar.verbose=true) and checking the output: you’ll get a precise view of which files are seen/considered/indexed.

(Tibor Blenessy) #6

In fact @weijian_ni you are right, vendor directory is excluded by default, because we expect that you don’t want to analyze dependencies of your project (they should be analyzed separately in their own project).

You can change that behavior by un-setting sonar.go.exclusions property, just set it to empty value. I am going to update our documentation about this.

(Nicolas Bontoux) #7

I stand corrected :open_mouth: Sorry for the initial mislead @weijian_ni, I didn’t realize there was a default exclusion hardcoded.