From 129a9f06381e1f52167c17c7d7e38211063c494f Mon Sep 17 00:00:00 2001 From: Quentin Brosse Date: Tue, 11 Feb 2020 14:16:18 +0100 Subject: [PATCH 1/3] feat(core): rename send_usage into send_telemetry --- go.mod | 2 +- go.sum | 2 ++ internal/matomo/matomo.go | 2 +- internal/namespaces/init/init.go | 16 ++++++++-------- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index fbeb676db8..8dd9ac0ee7 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ require ( github.com/mattn/go-colorable v0.1.2 // indirect github.com/mattn/go-isatty v0.0.9 github.com/pkg/errors v0.9.1 // indirect - github.com/scaleway/scaleway-sdk-go v1.0.0-beta.5.0.20200130170711-05d27d10a3b8 + github.com/scaleway/scaleway-sdk-go v1.0.0-beta.5.0.20200211104822-047c88bb15c4 github.com/sergi/go-diff v1.0.0 // indirect github.com/spf13/cobra v0.0.5 github.com/spf13/pflag v1.0.5 diff --git a/go.sum b/go.sum index 635bf2e4db..82e3ed0e5b 100644 --- a/go.sum +++ b/go.sum @@ -74,6 +74,8 @@ github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNue github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/scaleway/scaleway-sdk-go v1.0.0-beta.5.0.20200130170711-05d27d10a3b8 h1:+y+U0MHG110iL4TkTKEb3Wh07OK7ALY2XbNFxeAEb80= github.com/scaleway/scaleway-sdk-go v1.0.0-beta.5.0.20200130170711-05d27d10a3b8/go.mod h1:CJJ5VAbozOl0yEw7nHB9+7BXTJbIn6h7W+f6Gau5IP8= +github.com/scaleway/scaleway-sdk-go v1.0.0-beta.5.0.20200211104822-047c88bb15c4 h1:7MhGZPXmbEqx97kIrBA7Xen1obsqQPnR0HKErxh76S4= +github.com/scaleway/scaleway-sdk-go v1.0.0-beta.5.0.20200211104822-047c88bb15c4/go.mod h1:CJJ5VAbozOl0yEw7nHB9+7BXTJbIn6h7W+f6Gau5IP8= github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= diff --git a/internal/matomo/matomo.go b/internal/matomo/matomo.go index 799398b054..9583065c03 100644 --- a/internal/matomo/matomo.go +++ b/internal/matomo/matomo.go @@ -117,5 +117,5 @@ func IsTelemetryDisabled() bool { if err != nil { return false } - return !config.SendUsage + return !config.SendTelemetry } diff --git a/internal/namespaces/init/init.go b/internal/namespaces/init/init.go index edcbad6598..f374f54327 100644 --- a/internal/namespaces/init/init.go +++ b/internal/namespaces/init/init.go @@ -61,7 +61,7 @@ type initArgs struct { Region scw.Region Zone scw.Zone OrganizationID string - SendUsage *bool + SendTelemetry *bool InstallAutocomplete *bool } @@ -191,14 +191,14 @@ func initCommand() *core.Command { } // Ask for send usage permission - if args.SendUsage == nil { + if args.SendTelemetry == nil { _, _ = interactive.Println() _, _ = interactive.PrintlnWithoutIndent(` - To improve this tool we rely on diagnostic and usage data. - Sending such data is optional and can be disable at any time by running "scw config set send_usage false" + To improve this tools we rely on diagnostic and usage data. + Sending such data is optional and can be disable at any time by running "scw config set send_telemetry false" `) - sendUsage, err := interactive.PromptBoolWithConfig(&interactive.PromptBoolConfig{ + sendTelemetry, err := interactive.PromptBoolWithConfig(&interactive.PromptBoolConfig{ Prompt: "Do you want to send usage statistics and diagnostics?", DefaultValue: true, }) @@ -206,7 +206,7 @@ func initCommand() *core.Command { return err } - args.SendUsage = scw.BoolPtr(sendUsage) + args.SendTelemetry = scw.BoolPtr(sendTelemetry) } // Ask whether we should install autocomplete @@ -240,8 +240,8 @@ func initCommand() *core.Command { interactive.Printf("Creating new config at %v\n", scw.GetConfigPath()) } - if args.SendUsage != nil { - config.SendUsage = *args.SendUsage + if args.SendTelemetry != nil { + config.SendTelemetry = *args.SendTelemetry } // Update active profile From 0f3fb268b4afe09157c54f43e97799f0008f3b05 Mon Sep 17 00:00:00 2001 From: Quentin Brosse Date: Tue, 11 Feb 2020 14:28:40 +0100 Subject: [PATCH 2/3] fix tests --- .../e2e/testdata/test-human-create-simple.stdout.golden | 1 + .../testdata/test-human-create-with-args.stdout.golden | 1 + .../e2e/testdata/test-human-delete-simple.stdout.golden | 1 + internal/e2e/testdata/test-human-get-simple.stdout.golden | 1 + .../e2e/testdata/test-human-list-simple.stdout.golden | 8 ++++---- .../test-human-update-multiple-args.stdout.golden | 1 + .../testdata/test-human-update-single-arg.stdout.golden | 1 + 7 files changed, 10 insertions(+), 4 deletions(-) diff --git a/internal/e2e/testdata/test-human-create-simple.stdout.golden b/internal/e2e/testdata/test-human-create-simple.stdout.golden index bcb04229c0..188b9abad2 100644 --- a/internal/e2e/testdata/test-human-create-simple.stdout.golden +++ b/internal/e2e/testdata/test-human-create-simple.stdout.golden @@ -11,4 +11,5 @@ hair-count 0 is-happy false eyes-color unknown status stopped +name region fr-par diff --git a/internal/e2e/testdata/test-human-create-with-args.stdout.golden b/internal/e2e/testdata/test-human-create-with-args.stdout.golden index ebdd40ee9b..4dccc0afd6 100644 --- a/internal/e2e/testdata/test-human-create-with-args.stdout.golden +++ b/internal/e2e/testdata/test-human-create-with-args.stdout.golden @@ -11,4 +11,5 @@ hair-count 9223372036854775808 is-happy true eyes-color amber status stopped +name region fr-par diff --git a/internal/e2e/testdata/test-human-delete-simple.stdout.golden b/internal/e2e/testdata/test-human-delete-simple.stdout.golden index 2084fa4049..27717de5cd 100644 --- a/internal/e2e/testdata/test-human-delete-simple.stdout.golden +++ b/internal/e2e/testdata/test-human-delete-simple.stdout.golden @@ -11,4 +11,5 @@ hair-count 9223372036854775809 is-happy true eyes-color blue status stopped +name region fr-par diff --git a/internal/e2e/testdata/test-human-get-simple.stdout.golden b/internal/e2e/testdata/test-human-get-simple.stdout.golden index 2084fa4049..27717de5cd 100644 --- a/internal/e2e/testdata/test-human-get-simple.stdout.golden +++ b/internal/e2e/testdata/test-human-get-simple.stdout.golden @@ -11,4 +11,5 @@ hair-count 9223372036854775809 is-happy true eyes-color blue status stopped +name region fr-par diff --git a/internal/e2e/testdata/test-human-list-simple.stdout.golden b/internal/e2e/testdata/test-human-list-simple.stdout.golden index 9cba33b634..289c410396 100644 --- a/internal/e2e/testdata/test-human-list-simple.stdout.golden +++ b/internal/e2e/testdata/test-human-list-simple.stdout.golden @@ -1,4 +1,4 @@ -ID ORGANIZATION ID CREATED AT UPDATED AT HEIGHT SHOE SIZE ALTITUDE IN METER ALTITUDE IN MILLIMETER FINGERS COUNT HAIR COUNT IS HAPPY EYES COLOR STATUS REGION -0194fdc2-fa2f-fcc0-41d3-ff12045b73c8 11111111-1111-1111-1111-111111111111 few seconds ago few seconds ago 0 0 0 0 0 0 false unknown stopped fr-par -62a5eee8-2abd-f44a-2d0b-75fb180daf48 11111111-1111-1111-1111-111111111111 few seconds ago few seconds ago 0 0 0 0 0 0 false unknown stopped fr-par -39465185-0fd4-a178-892e-e285ece15114 11111111-1111-1111-1111-111111111111 few seconds ago few seconds ago 0 0 0 0 0 0 false unknown stopped fr-par +ID ORGANIZATION ID CREATED AT UPDATED AT HEIGHT SHOE SIZE ALTITUDE IN METER ALTITUDE IN MILLIMETER FINGERS COUNT HAIR COUNT IS HAPPY EYES COLOR STATUS NAME REGION +0194fdc2-fa2f-fcc0-41d3-ff12045b73c8 11111111-1111-1111-1111-111111111111 few seconds ago few seconds ago 0 0 0 0 0 0 false unknown stopped fr-par +62a5eee8-2abd-f44a-2d0b-75fb180daf48 11111111-1111-1111-1111-111111111111 few seconds ago few seconds ago 0 0 0 0 0 0 false unknown stopped fr-par +39465185-0fd4-a178-892e-e285ece15114 11111111-1111-1111-1111-111111111111 few seconds ago few seconds ago 0 0 0 0 0 0 false unknown stopped fr-par diff --git a/internal/e2e/testdata/test-human-update-multiple-args.stdout.golden b/internal/e2e/testdata/test-human-update-multiple-args.stdout.golden index b2a61ecd07..0352476d26 100644 --- a/internal/e2e/testdata/test-human-update-multiple-args.stdout.golden +++ b/internal/e2e/testdata/test-human-update-multiple-args.stdout.golden @@ -11,4 +11,5 @@ hair-count 9223372036854775809 is-happy true eyes-color blue status stopped +name region fr-par diff --git a/internal/e2e/testdata/test-human-update-single-arg.stdout.golden b/internal/e2e/testdata/test-human-update-single-arg.stdout.golden index cf01921f63..febd2e5f46 100644 --- a/internal/e2e/testdata/test-human-update-single-arg.stdout.golden +++ b/internal/e2e/testdata/test-human-update-single-arg.stdout.golden @@ -11,4 +11,5 @@ hair-count 9223372036854775808 is-happy false eyes-color amber status stopped +name region fr-par From 3459d7a3e851f72642d410fec337434925e4e02d Mon Sep 17 00:00:00 2001 From: Quentin Brosse Date: Tue, 11 Feb 2020 14:55:14 +0100 Subject: [PATCH 3/3] address olivier comments --- internal/namespaces/init/init.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/namespaces/init/init.go b/internal/namespaces/init/init.go index f374f54327..f7f114eb16 100644 --- a/internal/namespaces/init/init.go +++ b/internal/namespaces/init/init.go @@ -194,7 +194,7 @@ func initCommand() *core.Command { if args.SendTelemetry == nil { _, _ = interactive.Println() _, _ = interactive.PrintlnWithoutIndent(` - To improve this tools we rely on diagnostic and usage data. + To improve this tool we rely on diagnostic and usage data. Sending such data is optional and can be disable at any time by running "scw config set send_telemetry false" `)