From 7e5253c3d51e87d169077e12398af693fbe256f5 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 29 Aug 2024 22:21:07 +0000 Subject: [PATCH] fix(analytics): check do not track (#4329) (#4330) Our do not track check was wrong and always returning true. This is why we were getting nothing. (cherry picked from commit e04d0f6924154018999a1adf829565e4560c669c) Co-authored-by: Julien Robert Co-authored-by: Danilo Pantani --- ignite/internal/analytics/analytics.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ignite/internal/analytics/analytics.go b/ignite/internal/analytics/analytics.go index b31403bb4f..4b5936e26d 100644 --- a/ignite/internal/analytics/analytics.go +++ b/ignite/internal/analytics/analytics.go @@ -102,8 +102,10 @@ func SendMetric(wg *sync.WaitGroup, cmd *cobra.Command) { // checkDNT check if the user allow to track data or if the DO_NOT_TRACK // env var is set https://consoledonottrack.com/ func checkDNT() (anonIdentity, error) { - if dnt, err := strconv.ParseBool(os.Getenv(envDoNotTrack)); err != nil || dnt { - return anonIdentity{DoNotTrack: true}, nil + if dnt := os.Getenv(envDoNotTrack); dnt != "" { + if dnt, err := strconv.ParseBool(dnt); err != nil || dnt { + return anonIdentity{DoNotTrack: true}, nil + } } globalPath, err := config.DirPath()