瀏覽代碼

clientv3: make YamlConfig struct private

Anthony Romano 9 年之前
父節點
當前提交
04ef861c3d
共有 2 個文件被更改,包括 8 次插入8 次删除
  1. 2 2
      clientv3/config.go
  2. 6 6
      clientv3/config_test.go

+ 2 - 2
clientv3/config.go

@@ -45,7 +45,7 @@ type Config struct {
 	Logger Logger
 	Logger Logger
 }
 }
 
 
-type YamlConfig struct {
+type yamlConfig struct {
 	Endpoints             []string      `json:"endpoints"`
 	Endpoints             []string      `json:"endpoints"`
 	DialTimeout           time.Duration `json:"dial-timeout"`
 	DialTimeout           time.Duration `json:"dial-timeout"`
 	InsecureTransport     bool          `json:"insecure-transport"`
 	InsecureTransport     bool          `json:"insecure-transport"`
@@ -61,7 +61,7 @@ func configFromFile(fpath string) (*Config, error) {
 		return nil, err
 		return nil, err
 	}
 	}
 
 
-	yc := &YamlConfig{}
+	yc := &yamlConfig{}
 
 
 	err = yaml.Unmarshal(b, yc)
 	err = yaml.Unmarshal(b, yc)
 	if err != nil {
 	if err != nil {

+ 6 - 6
clientv3/config_test.go

@@ -32,22 +32,22 @@ var (
 
 
 func TestConfigFromFile(t *testing.T) {
 func TestConfigFromFile(t *testing.T) {
 	tests := []struct {
 	tests := []struct {
-		ym *YamlConfig
+		ym *yamlConfig
 
 
 		werr bool
 		werr bool
 	}{
 	}{
 		{
 		{
-			&YamlConfig{},
+			&yamlConfig{},
 			false,
 			false,
 		},
 		},
 		{
 		{
-			&YamlConfig{
+			&yamlConfig{
 				InsecureTransport: true,
 				InsecureTransport: true,
 			},
 			},
 			false,
 			false,
 		},
 		},
 		{
 		{
-			&YamlConfig{
+			&yamlConfig{
 				Keyfile:               privateKeyPath,
 				Keyfile:               privateKeyPath,
 				Certfile:              certPath,
 				Certfile:              certPath,
 				CAfile:                caPath,
 				CAfile:                caPath,
@@ -56,14 +56,14 @@ func TestConfigFromFile(t *testing.T) {
 			false,
 			false,
 		},
 		},
 		{
 		{
-			&YamlConfig{
+			&yamlConfig{
 				Keyfile:  "bad",
 				Keyfile:  "bad",
 				Certfile: "bad",
 				Certfile: "bad",
 			},
 			},
 			true,
 			true,
 		},
 		},
 		{
 		{
-			&YamlConfig{
+			&yamlConfig{
 				Keyfile:  privateKeyPath,
 				Keyfile:  privateKeyPath,
 				Certfile: certPath,
 				Certfile: certPath,
 				CAfile:   "bad",
 				CAfile:   "bad",