Skip to content

Commit

Permalink
fix: check if the os.Args have more than one element before cutting d…
Browse files Browse the repository at this point in the history
…own the first element (#1066)
  • Loading branch information
nicufk authored Mar 7, 2022
1 parent 285a4e2 commit e130668
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/analytics/analytics.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ func SendAnonymousInfo() {

func SendAnonymouscmdInfo() {
client := v1.NewClient(testkubeTrackingID, "golang")
command := []string{}
if len(os.Args) > 1 {
command = os.Args[1:]
}
payload := &gatypes.Payload{
HitType: "event",
DataSource: "CLI",
Expand All @@ -60,7 +64,7 @@ func SendAnonymouscmdInfo() {
ApplicationName: "testkube",
ApplicationVersion: commands.Version,
},
CustomDimensions: gatypes.StringList(os.Args[1:]),
CustomDimensions: gatypes.StringList(command),
}
client.SendPost(payload)
}
Expand Down

0 comments on commit e130668

Please sign in to comment.