Drop unnecessary type conversions

This commit is contained in:
ferhat elmas 2017-12-18 09:14:03 +01:00 committed by Traefiker
parent f6520727a3
commit 705f3f1372
8 changed files with 16 additions and 16 deletions

View file

@ -236,7 +236,7 @@ func (dc *DomainsCertificate) needRenew() bool {
return true
}
// <= 30 days left, renew certificate
if crt.NotAfter.Before(time.Now().Add(time.Duration(24 * 30 * time.Hour))) {
if crt.NotAfter.Before(time.Now().Add(24 * 30 * time.Hour)) {
return true
}
}

View file

@ -143,7 +143,7 @@ func pemEncode(data interface{}) []byte {
case *x509.CertificateRequest:
pemBlock = &pem.Block{Type: "CERTIFICATE REQUEST", Bytes: key.Raw}
case []byte:
pemBlock = &pem.Block{Type: "CERTIFICATE", Bytes: []byte(data.([]byte))}
pemBlock = &pem.Block{Type: "CERTIFICATE", Bytes: data.([]byte)}
}
return pem.EncodeToMemory(pemBlock)

View file

@ -267,12 +267,12 @@ func (dep *DefaultEntryPoints) Set(value string) error {
// Get return the EntryPoints map
func (dep *DefaultEntryPoints) Get() interface{} {
return DefaultEntryPoints(*dep)
return *dep
}
// SetValue sets the EntryPoints map with val
func (dep *DefaultEntryPoints) SetValue(val interface{}) {
*dep = DefaultEntryPoints(val.(DefaultEntryPoints))
*dep = val.(DefaultEntryPoints)
}
// Type is type of the struct
@ -405,12 +405,12 @@ func toBool(conf map[string]string, key string) bool {
// Get return the EntryPoints map
func (ep *EntryPoints) Get() interface{} {
return EntryPoints(*ep)
return *ep
}
// SetValue sets the EntryPoints map with val
func (ep *EntryPoints) SetValue(val interface{}) {
*ep = EntryPoints(val.(EntryPoints))
*ep = val.(EntryPoints)
}
// Type is type of the struct

View file

@ -21,12 +21,12 @@ func (c *Clusters) Set(str string) error {
}
// Get Clusters
func (c *Clusters) Get() interface{} { return Clusters(*c) }
func (c *Clusters) Get() interface{} { return *c }
// String return slice in a string
func (c *Clusters) String() string { return fmt.Sprintf("%v", *c) }
// SetValue sets Clusters into the parser
func (c *Clusters) SetValue(val interface{}) {
*c = Clusters(val.(Clusters))
*c = val.(Clusters)
}

View file

@ -21,12 +21,12 @@ func (ns *Namespaces) Set(str string) error {
}
//Get []string
func (ns *Namespaces) Get() interface{} { return Namespaces(*ns) }
func (ns *Namespaces) Get() interface{} { return *ns }
//String return slice in a string
func (ns *Namespaces) String() string { return fmt.Sprintf("%v", *ns) }
//SetValue sets []string into the parser
func (ns *Namespaces) SetValue(val interface{}) {
*ns = Namespaces(val.(Namespaces))
*ns = val.(Namespaces)
}

View file

@ -862,7 +862,7 @@ func buildServerTimeouts(globalConfig configuration.GlobalConfiguration) (readTi
} else if globalConfig.RespondingTimeouts != nil {
idleTimeout = time.Duration(globalConfig.RespondingTimeouts.IdleTimeout)
} else {
idleTimeout = time.Duration(configuration.DefaultIdleTimeout)
idleTimeout = configuration.DefaultIdleTimeout
}
return readTimeout, writeTimeout, idleTimeout

View file

@ -80,12 +80,12 @@ func (r *RootCAs) Set(value string) error {
// Get return the RootCAs list
func (r *RootCAs) Get() interface{} {
return RootCAs(*r)
return *r
}
// SetValue sets the RootCAs with val
func (r *RootCAs) SetValue(val interface{}) {
*r = RootCAs(val.(RootCAs))
*r = val.(RootCAs)
}
// Type is type of the struct

View file

@ -312,7 +312,7 @@ func (cs *Constraints) String() string { return fmt.Sprintf("%+v", *cs) }
//SetValue sets []*Constraint into the parser
func (cs *Constraints) SetValue(val interface{}) {
*cs = Constraints(val.(Constraints))
*cs = val.(Constraints)
}
// Type exports the Constraints type as a string
@ -427,14 +427,14 @@ func (b *Buckets) Set(str string) error {
}
//Get []float64
func (b *Buckets) Get() interface{} { return Buckets(*b) }
func (b *Buckets) Get() interface{} { return *b }
//String return slice in a string
func (b *Buckets) String() string { return fmt.Sprintf("%v", *b) }
//SetValue sets []float64 into the parser
func (b *Buckets) SetValue(val interface{}) {
*b = Buckets(val.(Buckets))
*b = val.(Buckets)
}
// TraefikLog holds the configuration settings for the traefik logger.