We have some generated code that we want to exclude from analysis as such we have this property in our sonar-project.properties:
sonar.go.exclusions =\ test/mock/**/*mock.go,\ **/*.event_type.go,\ **/*.pb.go,\ **/*_test.go,\ **/vendor/**
The *.pb.go and *_test.go files are not present in the SonarCloud reports but the *mock.go files under the test/mock/ subdirectories are still being reported.
For the sonar.exclusions property we also have some files that use a top level directory and this is excluded correctly so we suspect that the pattern matching for sonar.go.exclusions is not working consistently:
sonar.exclusions = \ _tools/**,\ **/vendor/**,\ **/.vendor-new/**
We did some experiments and changing the pattern from
**/test/mock/**/*mock.go is working.