mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
fix Struct Config has methods on both value and pointer receivers. Such usage is not recommended by the Go Documentation.
Signed-off-by: devincd <505259926@qq.com>
This commit is contained in:
parent
a2eb17c809
commit
931687f87e
@ -1122,7 +1122,7 @@ func (cfg *Config) GetDNSClusterNames() ([]string, error) {
|
||||
return clusterStrs, multierr.Combine(cerr, httpCerr)
|
||||
}
|
||||
|
||||
func (cfg Config) InitialClusterFromName(name string) (ret string) {
|
||||
func (cfg *Config) InitialClusterFromName(name string) (ret string) {
|
||||
if len(cfg.AdvertisePeerUrls) == 0 {
|
||||
return ""
|
||||
}
|
||||
@ -1136,21 +1136,21 @@ func (cfg Config) InitialClusterFromName(name string) (ret string) {
|
||||
return ret[1:]
|
||||
}
|
||||
|
||||
func (cfg Config) IsNewCluster() bool { return cfg.ClusterState == ClusterStateFlagNew }
|
||||
func (cfg Config) ElectionTicks() int { return int(cfg.ElectionMs / cfg.TickMs) }
|
||||
func (cfg *Config) IsNewCluster() bool { return cfg.ClusterState == ClusterStateFlagNew }
|
||||
func (cfg *Config) ElectionTicks() int { return int(cfg.ElectionMs / cfg.TickMs) }
|
||||
|
||||
func (cfg Config) V2DeprecationEffective() config.V2DeprecationEnum {
|
||||
func (cfg *Config) V2DeprecationEffective() config.V2DeprecationEnum {
|
||||
if cfg.V2Deprecation == "" {
|
||||
return config.V2_DEPR_DEFAULT
|
||||
}
|
||||
return cfg.V2Deprecation
|
||||
}
|
||||
|
||||
func (cfg Config) defaultPeerHost() bool {
|
||||
func (cfg *Config) defaultPeerHost() bool {
|
||||
return len(cfg.AdvertisePeerUrls) == 1 && cfg.AdvertisePeerUrls[0].String() == DefaultInitialAdvertisePeerURLs
|
||||
}
|
||||
|
||||
func (cfg Config) defaultClientHost() bool {
|
||||
func (cfg *Config) defaultClientHost() bool {
|
||||
return len(cfg.AdvertiseClientUrls) == 1 && cfg.AdvertiseClientUrls[0].String() == DefaultAdvertiseClientURLs
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ import (
|
||||
)
|
||||
|
||||
// GetLogger returns the logger.
|
||||
func (cfg Config) GetLogger() *zap.Logger {
|
||||
func (cfg *Config) GetLogger() *zap.Logger {
|
||||
cfg.loggerMu.RLock()
|
||||
l := cfg.logger
|
||||
cfg.loggerMu.RUnlock()
|
||||
|
Loading…
x
Reference in New Issue
Block a user