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