From 84c187fe0cf38b452902518fde172597a8562c71 Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Wed, 9 Jul 2014 21:47:55 +0000 Subject: [PATCH] update for consistency Docker-DCO-1.1-Signed-off-by: Victor Vieux (github: vieux) --- opts/opts.go | 5 +++-- opts/opts_test.go | 22 +++++++++++----------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/opts/opts.go b/opts/opts.go index b8018c13bf..b3ceeffda6 100644 --- a/opts/opts.go +++ b/opts/opts.go @@ -2,12 +2,13 @@ package opts import ( "fmt" - "github.com/dotcloud/docker/utils" "net" "os" "path/filepath" "regexp" "strings" + + "github.com/dotcloud/docker/utils" ) // ListOpts type @@ -129,7 +130,7 @@ func ValidateEnv(val string) (string, error) { return fmt.Sprintf("%s=%s", val, os.Getenv(val)), nil } -func ValidateIpAddress(val string) (string, error) { +func ValidateIPAddress(val string) (string, error) { var ip = net.ParseIP(strings.TrimSpace(val)) if ip != nil { return ip.String(), nil diff --git a/opts/opts_test.go b/opts/opts_test.go index 4d37fcaf3a..9494e27a75 100644 --- a/opts/opts_test.go +++ b/opts/opts_test.go @@ -4,25 +4,25 @@ import ( "testing" ) -func TestValidateIP4(t *testing.T) { - if ret, err := ValidateIpAddress(`1.2.3.4`); err != nil || ret == "" { - t.Fatalf("ValidateIpAddress(`1.2.3.4`) got %s %s", ret, err) +func TestValidateIPAddress(t *testing.T) { + if ret, err := ValidateIPAddress(`1.2.3.4`); err != nil || ret == "" { + t.Fatalf("ValidateIPAddress(`1.2.3.4`) got %s %s", ret, err) } - if ret, err := ValidateIpAddress(`127.0.0.1`); err != nil || ret == "" { - t.Fatalf("ValidateIpAddress(`127.0.0.1`) got %s %s", ret, err) + if ret, err := ValidateIPAddress(`127.0.0.1`); err != nil || ret == "" { + t.Fatalf("ValidateIPAddress(`127.0.0.1`) got %s %s", ret, err) } - if ret, err := ValidateIpAddress(`::1`); err != nil || ret == "" { - t.Fatalf("ValidateIpAddress(`::1`) got %s %s", ret, err) + if ret, err := ValidateIPAddress(`::1`); err != nil || ret == "" { + t.Fatalf("ValidateIPAddress(`::1`) got %s %s", ret, err) } - if ret, err := ValidateIpAddress(`127`); err == nil || ret != "" { - t.Fatalf("ValidateIpAddress(`127`) got %s %s", ret, err) + if ret, err := ValidateIPAddress(`127`); err == nil || ret != "" { + t.Fatalf("ValidateIPAddress(`127`) got %s %s", ret, err) } - if ret, err := ValidateIpAddress(`random invalid string`); err == nil || ret != "" { - t.Fatalf("ValidateIpAddress(`random invalid string`) got %s %s", ret, err) + if ret, err := ValidateIPAddress(`random invalid string`); err == nil || ret != "" { + t.Fatalf("ValidateIPAddress(`random invalid string`) got %s %s", ret, err) } }