Skip to content

Commit 1376628

Browse files
tiansuo114caoxianfei1
authored andcommitted
remove getName in hc_get
Signed-off-by: noobcoder <[email protected]>
1 parent ed6a13d commit 1376628

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

internal/configure/hosts/hc_get.go

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,7 @@ func (hc *HostConfig) getBool(i *comm.Item) bool {
6767
return v.(bool)
6868
}
6969

70-
func (hc *HostConfig) getName() string {
71-
res := hc.GetHost()
72-
if res != "" {
73-
return res
74-
}
75-
76-
return hc.getString(CONFIG_NAME)
77-
}
78-
79-
func (hc *HostConfig) GetHost() string { return hc.getString(CONFIG_HOST) }
80-
func (hc *HostConfig) GetName() string { return hc.getName() }
70+
func (hc *HostConfig) GetName() string { return hc.getString(CONFIG_NAME) }
8171
func (hc *HostConfig) GetHostname() string { return hc.getString(CONFIG_HOSTNAME) }
8272
func (hc *HostConfig) GetSSHHostname() string { return hc.getString(CONFIG_SSH_HOSTNAME) }
8373
func (hc *HostConfig) GetSSHPort() int { return hc.getInt(CONFIG_SSH_PORT) }

internal/configure/hosts/hc_item.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,11 @@ var (
4949
"name",
5050
comm.REQUIRE_STRING,
5151
false,
52-
nil,
52+
func(hc *HostConfig) interface{} {
53+
return hc.getString(CONFIG_HOST)
54+
},
5355
)
56+
5457
CONFIG_HOSTNAME = itemset.Insert(
5558
"hostname",
5659
comm.REQUIRE_STRING,

0 commit comments

Comments
 (0)