From 4e6f0f9a7978db4c2448379c91671a23ef96f825 Mon Sep 17 00:00:00 2001 From: Matt Keeler Date: Thu, 29 Mar 2018 14:35:49 -0400 Subject: [PATCH] Formatting update --- command/validate/validate.go | 4 ++-- command/validate/validate_test.go | 32 +++++++++++++++---------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/command/validate/validate.go b/command/validate/validate.go index f4bf9053c8..673f49a99b 100644 --- a/command/validate/validate.go +++ b/command/validate/validate.go @@ -21,8 +21,8 @@ type cmd struct { // ConfigFormat forces all config files to be interpreted as this // format independent of their extension. configFormat string - quiet bool - help string + quiet bool + help string } func (c *cmd) init() { diff --git a/command/validate/validate_test.go b/command/validate/validate_test.go index a375b02fcb..f6bd6717ac 100644 --- a/command/validate/validate_test.go +++ b/command/validate/validate_test.go @@ -50,58 +50,58 @@ func TestValidateCommand_SucceedOnMinimalConfigFile(t *testing.T) { } } -func TestValidateCommand_SucceedWithMinimalJSONConfigFormat(t * testing.T) { +func TestValidateCommand_SucceedWithMinimalJSONConfigFormat(t *testing.T) { t.Parallel() td := testutil.TempDir(t, "consul") defer os.RemoveAll(td) - + fp := filepath.Join(td, "json.conf") err := ioutil.WriteFile(fp, []byte(`{"bind_addr":"10.0.0.1", "data_dir":"`+td+`"}`), 0644) if err != nil { t.Fatalf("err: %s", err) } - + cmd := New(cli.NewMockUi()) args := []string{"--config-format", "json", fp} - + if code := cmd.Run(args); code != 0 { t.Fatalf("bad: %d", code) } } -func TestValidateCommand_SucceedWithMinimalHCLConfigFormat(t * testing.T) { +func TestValidateCommand_SucceedWithMinimalHCLConfigFormat(t *testing.T) { t.Parallel() td := testutil.TempDir(t, "consul") defer os.RemoveAll(td) - + fp := filepath.Join(td, "hcl.conf") err := ioutil.WriteFile(fp, []byte("bind_addr = \"10.0.0.1\"\ndata_dir = \""+td+"\""), 0644) if err != nil { t.Fatalf("err: %s", err) } - + cmd := New(cli.NewMockUi()) args := []string{"--config-format", "hcl", fp} - + if code := cmd.Run(args); code != 0 { t.Fatalf("bad: %d", code) } } -func TestValidateCommand_SucceedWithJSONAsHCL(t * testing.T) { +func TestValidateCommand_SucceedWithJSONAsHCL(t *testing.T) { t.Parallel() td := testutil.TempDir(t, "consul") defer os.RemoveAll(td) - + fp := filepath.Join(td, "json.conf") err := ioutil.WriteFile(fp, []byte(`{"bind_addr":"10.0.0.1", "data_dir":"`+td+`"}`), 0644) if err != nil { t.Fatalf("err: %s", err) } - + cmd := New(cli.NewMockUi()) args := []string{"--config-format", "hcl", fp} - + if code := cmd.Run(args); code != 0 { t.Fatalf("bad: %d", code) } @@ -125,20 +125,20 @@ func TestValidateCommand_SucceedOnMinimalConfigDir(t *testing.T) { } } -func TestValidateCommand_FailForInvalidJSONConfigFormat(t * testing.T) { +func TestValidateCommand_FailForInvalidJSONConfigFormat(t *testing.T) { t.Parallel() td := testutil.TempDir(t, "consul") defer os.RemoveAll(td) - + fp := filepath.Join(td, "hcl.conf") err := ioutil.WriteFile(fp, []byte(`bind_addr = "10.0.0.1"\ndata_dir = "`+td+`"`), 0644) if err != nil { t.Fatalf("err: %s", err) } - + cmd := New(cli.NewMockUi()) args := []string{"--config-format", "json", fp} - + if code := cmd.Run(args); code == 0 { t.Fatalf("bad: %d", code) }