Description: Remove code that tracks user behavior
Author: Lucca Braga Godoy Mendonça <lucca.mendonca@gmail.com>
Origin: vendor
Forwarded: https://github.com/Kong/deck/pull/242
Last-Update: 2021-02-02
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/cmd/analytics.go
+++ /dev/null
@@ -1,40 +0,0 @@
-package cmd
-
-import (
-	"context"
-	"net/http"
-	"os"
-)
-
-func sendAnalytics(ctx context.Context) {
-	const (
-		minOSArgs = 2
-	)
-
-	if os.Getenv("DECK_ANALYTICS") == "off" {
-		return
-	}
-
-	if len(os.Args) < minOSArgs {
-		return
-	}
-
-	cmd := os.Args[1]
-	if cmd == "help" ||
-		cmd == "ping" ||
-		cmd == "version" {
-		return
-	}
-
-	// HTTP to avoid latency due to handshake
-	URL := "http://d.yolo42.com/" + cmd
-
-	req, _ := http.NewRequestWithContext(ctx, "GET", URL, nil)
-	req.Header["deck-version"] = []string{VERSION}
-
-	resp, err := http.DefaultClient.Do(req)
-	if err != nil {
-		return
-	}
-	resp.Body.Close()
-}
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -1,7 +1,6 @@
 package cmd
 
 import (
-	"context"
 	"fmt"
 	"net/url"
 	"os"
@@ -44,19 +43,11 @@
 func Execute() {
 	var wg sync.WaitGroup
 	var err error
-	const threads = 2
+	const threads = 1
 	wg.Add(threads)
 
-	ctx, cancel := context.WithCancel(context.Background())
-
-	go func() {
-		defer wg.Done()
-		sendAnalytics(ctx)
-	}()
-
 	go func() {
 		defer wg.Done()
-		defer cancel()
 		err = rootCmd.Execute()
 	}()
 
