From b80730d8a4fa7c1c22904a3b8fa6980236afd007 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Sat, 8 Jan 2022 23:14:43 +0800 Subject: [PATCH] fix: use GA_TRACKING_ID --- .github/workflows/release.yml | 2 -- .github/workflows/unittest.yml | 2 -- internal/ga/init.go | 7 ++++--- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 297b913..ba7c612 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,8 +21,6 @@ jobs: uses: actions/checkout@v2 - name: Release hrp cli binaries uses: wangyoucao577/go-release-action@v1.22 - env: - GA_TRACKING_ID: ${{ secrets.GA_TRACKING_ID }} with: github_token: ${{ secrets.GITHUB_TOKEN }} goos: ${{ matrix.goos }} diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 80f4e31..6a1558e 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -27,8 +27,6 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - name: Run coverage - env: - GA_TRACKING_ID: ${{ secrets.GA_TRACKING_ID }} run: go test -coverprofile="cover.out" -covermode=atomic -race ./... - name: Upload coverage to Codecov uses: codecov/codecov-action@v2 diff --git a/internal/ga/init.go b/internal/ga/init.go index 4f9c83c..b759398 100644 --- a/internal/ga/init.go +++ b/internal/ga/init.go @@ -1,16 +1,17 @@ package ga import ( - "os" - "github.com/denisbrodbeck/machineid" "github.com/google/uuid" ) +const ( + trackingID = "UA-114587036-1" // Tracking ID for Google Analytics +) + var gaClient *GAClient func init() { - trackingID := os.Getenv("GA_TRACKING_ID") // Tracking ID for Google Analytics clientID, err := machineid.ProtectedID("hrp") if err != nil { nodeUUID, _ := uuid.NewUUID()