Go code coverage not showing in sonar cloud update

My problem is currently we are successful in showing code coverage by using this snipset code but after the display of sonar cloud update, the code coverage not showing again.

  • github/action
on:
  # Trigger analysis when pushing in master or pull requests, and when creating
  # a pull request.
  push:
    branches:
      - dev
      - master
      - pre_release
  pull_request:
    types: [opened, synchronize, reopened]
name: Main Workflow
jobs:
  sonarcloud:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          # Disabling shallow clone is recommended for improving relevancy of reporting
          fetch-depth: 0
      - uses: actions/setup-go@v2
      - run: |
              go version &&
              go test -covermode=atomic -coverprofile=coverage.out ./... &&
              ls -lah
              exit 0
      - name: SonarCloud Scan
        uses: sonarsource/sonarcloud-github-action@master
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
  • sonar.properties
sonar.organization=my
sonar.projectKey=my-key
sonar.projectVersion=1.0

sonar.sources=.
sonar.exclusions=**/*_test.go,**/vendor/**,**/testdata/*

sonar.tests=.
sonar.test.inclusions=**/*_test.go
sonar.test.exclusions=**/vendor/**
sonar.go.coverage.reportPaths=coverage.out
sonar.go.tests.reportPaths=report.json

Closing this post as it’s a duplicate of [HELP] Golang code coverage not working anymore