浏览代码

Merge pull request #5085 from heyitsanthony/hide-yaml

clientv3: make YamlConfig struct private
Anthony Romano 9 年之前
父节点
当前提交
57448622d9
共有 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
 }
 
-type YamlConfig struct {
+type yamlConfig struct {
 	Endpoints             []string      `json:"endpoints"`
 	DialTimeout           time.Duration `json:"dial-timeout"`
 	InsecureTransport     bool          `json:"insecure-transport"`
@@ -61,7 +61,7 @@ func configFromFile(fpath string) (*Config, error) {
 		return nil, err
 	}
 
-	yc := &YamlConfig{}
+	yc := &yamlConfig{}
 
 	err = yaml.Unmarshal(b, yc)
 	if err != nil {

+ 6 - 6
clientv3/config_test.go

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