瀏覽代碼

opts: format code with gofumpt

Formatting the code with https://github.com/mvdan/gofumpt

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 3 年之前
父節點
當前提交
091991606a
共有 3 個文件被更改,包括 4 次插入6 次删除
  1. 2 2
      opts/address_pools_test.go
  2. 1 3
      opts/hosts_test.go
  3. 1 1
      opts/opts.go

+ 2 - 2
opts/address_pools_test.go

@@ -6,8 +6,8 @@ import (
 
 func TestAddressPoolOpt(t *testing.T) {
 	poolopt := &PoolsOpt{}
-	var addresspool = "base=175.30.0.0/16,size=16"
-	var invalidAddresspoolString = "base=175.30.0.0/16,size=16, base=175.33.0.0/16,size=24"
+	addresspool := "base=175.30.0.0/16,size=16"
+	invalidAddresspoolString := "base=175.30.0.0/16,size=16, base=175.33.0.0/16,size=24"
 
 	if err := poolopt.Set(addresspool); err != nil {
 		t.Fatal(err)

+ 1 - 3
opts/hosts_test.go

@@ -139,9 +139,7 @@ func TestParseDockerDaemonHost(t *testing.T) {
 }
 
 func TestParseTCP(t *testing.T) {
-	var (
-		defaultHTTPHost = "tcp://127.0.0.1:8888"
-	)
+	defaultHTTPHost := "tcp://127.0.0.1:8888"
 	invalids := map[string]string{
 		"tcp:a.b.c.d":                 `invalid bind address (tcp:a.b.c.d): parse "tcp://tcp:a.b.c.d": invalid port ":a.b.c.d" after host`,
 		"tcp:a.b.c.d/path":            `invalid bind address (tcp:a.b.c.d/path): parse "tcp://tcp:a.b.c.d/path": invalid port ":a.b.c.d" after host`,

+ 1 - 1
opts/opts.go

@@ -300,7 +300,7 @@ type ValidatorFctListType func(val string) ([]string, error)
 
 // ValidateIPAddress validates an Ip address.
 func ValidateIPAddress(val string) (string, error) {
-	var ip = net.ParseIP(strings.TrimSpace(val))
+	ip := net.ParseIP(strings.TrimSpace(val))
 	if ip != nil {
 		return ip.String(), nil
 	}