diff --git a/command/agent/agent_endpoint_test.go b/command/agent/agent_endpoint_test.go index 8988493273..e333b48bc9 100644 --- a/command/agent/agent_endpoint_test.go +++ b/command/agent/agent_endpoint_test.go @@ -259,7 +259,7 @@ func TestAgent_Reload(t *testing.T) { ShutdownCh: shutdownCh, Command: base.Command{ Flags: base.FlagSetNone, - UI: new(cli.MockUi), + UI: cli.NewMockUi(), }, } diff --git a/command/agent/command_test.go b/command/agent/command_test.go index 2b115107c4..1c96607344 100644 --- a/command/agent/command_test.go +++ b/command/agent/command_test.go @@ -120,7 +120,7 @@ func TestRetryJoin(t *testing.T) { cmd := &Command{ Version: version.Version, ShutdownCh: shutdownCh, - Command: baseCommand(new(cli.MockUi)), + Command: baseCommand(cli.NewMockUi()), } serfAddr := fmt.Sprintf( @@ -181,7 +181,7 @@ func TestReadCliConfig(t *testing.T) { "-node-meta", "somekey:somevalue", }, ShutdownCh: shutdownCh, - Command: baseCommand(new(cli.MockUi)), + Command: baseCommand(cli.NewMockUi()), } config := cmd.readConfig() @@ -208,7 +208,7 @@ func TestReadCliConfig(t *testing.T) { "-node-meta", "otherkey:othervalue", }, ShutdownCh: shutdownCh, - Command: baseCommand(new(cli.MockUi)), + Command: baseCommand(cli.NewMockUi()), } expected := map[string]string{ "somekey": "somevalue", @@ -222,7 +222,7 @@ func TestReadCliConfig(t *testing.T) { // Test LeaveOnTerm and SkipLeaveOnInt defaults for server mode { - ui := new(cli.MockUi) + ui := cli.NewMockUi() cmd := &Command{ args: []string{ "-node", `"server1"`, @@ -250,7 +250,7 @@ func TestReadCliConfig(t *testing.T) { // Test LeaveOnTerm and SkipLeaveOnInt defaults for client mode { - ui := new(cli.MockUi) + ui := cli.NewMockUi() cmd := &Command{ args: []string{ "-data-dir", tmpDir, @@ -280,7 +280,7 @@ func TestReadCliConfig(t *testing.T) { cmd := &Command{ args: []string{"-node", `""`}, ShutdownCh: shutdownCh, - Command: baseCommand(new(cli.MockUi)), + Command: baseCommand(cli.NewMockUi()), } config := cmd.readConfig() @@ -301,7 +301,7 @@ func TestRetryJoinFail(t *testing.T) { cmd := &Command{ ShutdownCh: shutdownCh, - Command: baseCommand(new(cli.MockUi)), + Command: baseCommand(cli.NewMockUi()), } serfAddr := fmt.Sprintf("%s:%d", cfg.BindAddr, cfg.Ports.SerfLan) @@ -330,7 +330,7 @@ func TestRetryJoinWanFail(t *testing.T) { cmd := &Command{ ShutdownCh: shutdownCh, - Command: baseCommand(new(cli.MockUi)), + Command: baseCommand(cli.NewMockUi()), } serfAddr := fmt.Sprintf("%s:%d", cfg.BindAddr, cfg.Ports.SerfWan) @@ -462,7 +462,7 @@ func TestProtectDataDir(t *testing.T) { t.Fatalf("err: %v", err) } - ui := new(cli.MockUi) + ui := cli.NewMockUi() cmd := &Command{ Command: baseCommand(ui), args: []string{"-config-file=" + cfgFile.Name()}, @@ -486,7 +486,7 @@ func TestBadDataDirPermissions(t *testing.T) { } defer os.RemoveAll(dataDir) - ui := new(cli.MockUi) + ui := cli.NewMockUi() cmd := &Command{ Command: baseCommand(ui), args: []string{"-data-dir=" + dataDir, "-server=true"}, diff --git a/command/configtest_test.go b/command/configtest_test.go index 487045ab2f..29d0fbf12f 100644 --- a/command/configtest_test.go +++ b/command/configtest_test.go @@ -12,7 +12,7 @@ import ( ) func testConfigTestCommand(t *testing.T) (*cli.MockUi, *ConfigTestCommand) { - ui := new(cli.MockUi) + ui := cli.NewMockUi() return ui, &ConfigTestCommand{ Command: base.Command{ UI: ui, diff --git a/command/event_test.go b/command/event_test.go index a3c00c3731..a5ff27b04b 100644 --- a/command/event_test.go +++ b/command/event_test.go @@ -19,7 +19,7 @@ func TestEventCommandRun(t *testing.T) { a1 := agent.NewTestAgent(t.Name(), nil) defer a1.Shutdown() - ui := new(cli.MockUi) + ui := cli.NewMockUi() c := &EventCommand{ Command: base.Command{ UI: ui, diff --git a/command/exec_test.go b/command/exec_test.go index 565e6a997f..00a7cca645 100644 --- a/command/exec_test.go +++ b/command/exec_test.go @@ -14,7 +14,7 @@ import ( ) func testExecCommand(t *testing.T) (*cli.MockUi, *ExecCommand) { - ui := new(cli.MockUi) + ui := cli.NewMockUi() return ui, &ExecCommand{ Command: base.Command{ UI: ui, diff --git a/command/force_leave_test.go b/command/force_leave_test.go index fef1dbe641..8aeec13ab4 100644 --- a/command/force_leave_test.go +++ b/command/force_leave_test.go @@ -13,7 +13,7 @@ import ( ) func testForceLeaveCommand(t *testing.T) (*cli.MockUi, *ForceLeaveCommand) { - ui := new(cli.MockUi) + ui := cli.NewMockUi() return ui, &ForceLeaveCommand{ Command: base.Command{ UI: ui, @@ -68,7 +68,7 @@ func TestForceLeaveCommandRun(t *testing.T) { func TestForceLeaveCommandRun_noAddrs(t *testing.T) { t.Parallel() - ui := new(cli.MockUi) + ui := cli.NewMockUi() ui, c := testForceLeaveCommand(t) args := []string{"-http-addr=foo"} diff --git a/command/info_test.go b/command/info_test.go index 8abca70144..6f3acb502a 100644 --- a/command/info_test.go +++ b/command/info_test.go @@ -19,7 +19,7 @@ func TestInfoCommandRun(t *testing.T) { a1 := agent.NewTestAgent(t.Name(), nil) defer a1.Shutdown() - ui := new(cli.MockUi) + ui := cli.NewMockUi() c := &InfoCommand{ Command: base.Command{ UI: ui, diff --git a/command/join_test.go b/command/join_test.go index 9cee715420..fbf3756347 100644 --- a/command/join_test.go +++ b/command/join_test.go @@ -11,7 +11,7 @@ import ( ) func testJoinCommand(t *testing.T) (*cli.MockUi, *JoinCommand) { - ui := new(cli.MockUi) + ui := cli.NewMockUi() return ui, &JoinCommand{ Command: base.Command{ UI: ui, diff --git a/command/keygen_test.go b/command/keygen_test.go index 36fbbaba6e..481bdc7c2e 100644 --- a/command/keygen_test.go +++ b/command/keygen_test.go @@ -15,7 +15,7 @@ func TestKeygenCommand_implements(t *testing.T) { func TestKeygenCommand(t *testing.T) { t.Parallel() - ui := new(cli.MockUi) + ui := cli.NewMockUi() c := &KeygenCommand{ Command: base.Command{ UI: ui, diff --git a/command/keyring_test.go b/command/keyring_test.go index 25b22d0067..f664aaea9d 100644 --- a/command/keyring_test.go +++ b/command/keyring_test.go @@ -10,7 +10,7 @@ import ( ) func testKeyringCommand(t *testing.T) (*cli.MockUi, *KeyringCommand) { - ui := new(cli.MockUi) + ui := cli.NewMockUi() return ui, &KeyringCommand{ Command: base.Command{ UI: ui, diff --git a/command/kv_delete_test.go b/command/kv_delete_test.go index aff248ea65..a2fa9aba0e 100644 --- a/command/kv_delete_test.go +++ b/command/kv_delete_test.go @@ -12,7 +12,7 @@ import ( ) func testKVDeleteCommand(t *testing.T) (*cli.MockUi, *KVDeleteCommand) { - ui := new(cli.MockUi) + ui := cli.NewMockUi() return ui, &KVDeleteCommand{ Command: base.Command{ UI: ui, diff --git a/command/kv_export_test.go b/command/kv_export_test.go index db123b10a3..baf797df86 100644 --- a/command/kv_export_test.go +++ b/command/kv_export_test.go @@ -17,7 +17,7 @@ func TestKVExportCommand_Run(t *testing.T) { defer a.Shutdown() client := a.Client() - ui := new(cli.MockUi) + ui := cli.NewMockUi() c := KVExportCommand{ Command: base.Command{ UI: ui, diff --git a/command/kv_get_test.go b/command/kv_get_test.go index 035d6f1725..ad994d5e4b 100644 --- a/command/kv_get_test.go +++ b/command/kv_get_test.go @@ -12,7 +12,7 @@ import ( ) func testKVGetCommand(t *testing.T) (*cli.MockUi, *KVGetCommand) { - ui := new(cli.MockUi) + ui := cli.NewMockUi() return ui, &KVGetCommand{ Command: base.Command{ UI: ui, diff --git a/command/kv_import_test.go b/command/kv_import_test.go index d4e2dfd2bb..5cc273a743 100644 --- a/command/kv_import_test.go +++ b/command/kv_import_test.go @@ -28,7 +28,7 @@ func TestKVImportCommand_Run(t *testing.T) { } ]` - ui := new(cli.MockUi) + ui := cli.NewMockUi() c := &KVImportCommand{ Command: base.Command{ UI: ui, diff --git a/command/kv_put_test.go b/command/kv_put_test.go index 84f36f10c6..89103e663e 100644 --- a/command/kv_put_test.go +++ b/command/kv_put_test.go @@ -17,7 +17,7 @@ import ( ) func testKVPutCommand(t *testing.T) (*cli.MockUi, *KVPutCommand) { - ui := new(cli.MockUi) + ui := cli.NewMockUi() return ui, &KVPutCommand{ Command: base.Command{ UI: ui, diff --git a/command/leave_test.go b/command/leave_test.go index d9cbb1f72f..4e82fa98ac 100644 --- a/command/leave_test.go +++ b/command/leave_test.go @@ -10,7 +10,7 @@ import ( ) func testLeaveCommand(t *testing.T) (*cli.MockUi, *LeaveCommand) { - ui := new(cli.MockUi) + ui := cli.NewMockUi() return ui, &LeaveCommand{ Command: base.Command{ UI: ui, diff --git a/command/lock_test.go b/command/lock_test.go index 332b4e03d8..34988c3695 100644 --- a/command/lock_test.go +++ b/command/lock_test.go @@ -15,7 +15,7 @@ import ( ) func testLockCommand(t *testing.T) (*cli.MockUi, *LockCommand) { - ui := new(cli.MockUi) + ui := cli.NewMockUi() return ui, &LockCommand{ Command: base.Command{ UI: ui, diff --git a/command/maint_test.go b/command/maint_test.go index 92d931792c..87527f1794 100644 --- a/command/maint_test.go +++ b/command/maint_test.go @@ -11,7 +11,7 @@ import ( ) func testMaintCommand(t *testing.T) (*cli.MockUi, *MaintCommand) { - ui := new(cli.MockUi) + ui := cli.NewMockUi() return ui, &MaintCommand{ Command: base.Command{ UI: ui, diff --git a/command/members_test.go b/command/members_test.go index 64355df968..6ecd8bb258 100644 --- a/command/members_test.go +++ b/command/members_test.go @@ -11,7 +11,7 @@ import ( ) func testMembersCommand(t *testing.T) (*cli.MockUi, *MembersCommand) { - ui := new(cli.MockUi) + ui := cli.NewMockUi() return ui, &MembersCommand{ Command: base.Command{ UI: ui, diff --git a/command/operator_autopilot_get_test.go b/command/operator_autopilot_get_test.go index c2ae1eea6a..9ec7ebb6e9 100644 --- a/command/operator_autopilot_get_test.go +++ b/command/operator_autopilot_get_test.go @@ -19,7 +19,7 @@ func TestOperator_Autopilot_Get(t *testing.T) { a := agent.NewTestAgent(t.Name(), nil) defer a.Shutdown() - ui := new(cli.MockUi) + ui := cli.NewMockUi() c := OperatorAutopilotGetCommand{ Command: base.Command{ UI: ui, diff --git a/command/operator_autopilot_set_test.go b/command/operator_autopilot_set_test.go index c92b55e0bf..49bfa047dd 100644 --- a/command/operator_autopilot_set_test.go +++ b/command/operator_autopilot_set_test.go @@ -21,7 +21,7 @@ func TestOperator_Autopilot_Set(t *testing.T) { a := agent.NewTestAgent(t.Name(), nil) defer a.Shutdown() - ui := new(cli.MockUi) + ui := cli.NewMockUi() c := OperatorAutopilotSetCommand{ Command: base.Command{ UI: ui, diff --git a/command/operator_raft_list_test.go b/command/operator_raft_list_test.go index add7f817c1..8846fb1bc1 100644 --- a/command/operator_raft_list_test.go +++ b/command/operator_raft_list_test.go @@ -40,7 +40,7 @@ func TestOperator_Raft_ListPeers(t *testing.T) { // Test the list-peers subcommand directly { - ui := new(cli.MockUi) + ui := cli.NewMockUi() c := OperatorRaftListCommand{ Command: base.Command{ UI: ui, diff --git a/command/operator_raft_remove_test.go b/command/operator_raft_remove_test.go index fe2ead2cc9..f9629dcd0c 100644 --- a/command/operator_raft_remove_test.go +++ b/command/operator_raft_remove_test.go @@ -38,7 +38,7 @@ func TestOperator_Raft_RemovePeer(t *testing.T) { // Test the remove-peer subcommand directly { - ui := new(cli.MockUi) + ui := cli.NewMockUi() c := OperatorRaftRemoveCommand{ Command: base.Command{ UI: ui, @@ -61,7 +61,7 @@ func TestOperator_Raft_RemovePeer(t *testing.T) { // Test the remove-peer subcommand with -id { - ui := new(cli.MockUi) + ui := cli.NewMockUi() c := OperatorRaftRemoveCommand{ Command: base.Command{ UI: ui, diff --git a/command/operator_raft_test.go b/command/operator_raft_test.go index 09b3b343ec..3fe12d5e05 100644 --- a/command/operator_raft_test.go +++ b/command/operator_raft_test.go @@ -8,7 +8,7 @@ import ( ) func testOperatorRaftCommand(t *testing.T) (*cli.MockUi, *OperatorRaftCommand) { - ui := new(cli.MockUi) + ui := cli.NewMockUi() return ui, &OperatorRaftCommand{ Command: base.Command{ UI: ui, diff --git a/command/reload_test.go b/command/reload_test.go index ad8128ec01..fdedb2fbe4 100644 --- a/command/reload_test.go +++ b/command/reload_test.go @@ -25,7 +25,7 @@ func TestReloadCommandRun(t *testing.T) { errCh <- nil }() - ui := new(cli.MockUi) + ui := cli.NewMockUi() c := &ReloadCommand{ Command: base.Command{ UI: ui, diff --git a/command/rtt_test.go b/command/rtt_test.go index 755cf9c02e..c11cb13b70 100644 --- a/command/rtt_test.go +++ b/command/rtt_test.go @@ -15,7 +15,7 @@ import ( ) func testRTTCommand(t *testing.T) (*cli.MockUi, *RTTCommand) { - ui := new(cli.MockUi) + ui := cli.NewMockUi() return ui, &RTTCommand{ Command: base.Command{ UI: ui, diff --git a/command/snapshot_inspect_test.go b/command/snapshot_inspect_test.go index 1dc7e70c11..852baf7a97 100644 --- a/command/snapshot_inspect_test.go +++ b/command/snapshot_inspect_test.go @@ -14,7 +14,7 @@ import ( ) func testSnapshotInspectCommand(t *testing.T) (*cli.MockUi, *SnapshotInspectCommand) { - ui := new(cli.MockUi) + ui := cli.NewMockUi() return ui, &SnapshotInspectCommand{ Command: base.Command{ UI: ui, diff --git a/command/snapshot_restore_test.go b/command/snapshot_restore_test.go index c26f178e77..23af9d231c 100644 --- a/command/snapshot_restore_test.go +++ b/command/snapshot_restore_test.go @@ -14,7 +14,7 @@ import ( ) func testSnapshotRestoreCommand(t *testing.T) (*cli.MockUi, *SnapshotRestoreCommand) { - ui := new(cli.MockUi) + ui := cli.NewMockUi() return ui, &SnapshotRestoreCommand{ Command: base.Command{ UI: ui, diff --git a/command/snapshot_save_test.go b/command/snapshot_save_test.go index e5ea36104b..b2001e134a 100644 --- a/command/snapshot_save_test.go +++ b/command/snapshot_save_test.go @@ -13,7 +13,7 @@ import ( ) func testSnapshotSaveCommand(t *testing.T) (*cli.MockUi, *SnapshotSaveCommand) { - ui := new(cli.MockUi) + ui := cli.NewMockUi() return ui, &SnapshotSaveCommand{ Command: base.Command{ UI: ui, diff --git a/command/validate_test.go b/command/validate_test.go index e251403f84..f6ead54e41 100644 --- a/command/validate_test.go +++ b/command/validate_test.go @@ -12,7 +12,7 @@ import ( ) func testValidateCommand(t *testing.T) (*cli.MockUi, *ValidateCommand) { - ui := new(cli.MockUi) + ui := cli.NewMockUi() return ui, &ValidateCommand{ Command: base.Command{ UI: ui, diff --git a/command/watch_test.go b/command/watch_test.go index 9fc8e254ce..abf8dd6282 100644 --- a/command/watch_test.go +++ b/command/watch_test.go @@ -19,7 +19,7 @@ func TestWatchCommandRun(t *testing.T) { a := agent.NewTestAgent(t.Name(), nil) defer a.Shutdown() - ui := new(cli.MockUi) + ui := cli.NewMockUi() c := &WatchCommand{ Command: base.Command{ UI: ui,