Fix the golint, gosimple warnings

This commit is contained in:
Murat Kabilov
2017-05-18 17:38:54 +02:00
committed by GitHub
parent 233e8529c1
commit d34273543e
19 changed files with 91 additions and 133 deletions
+1 -2
View File
@@ -22,7 +22,7 @@ type Config struct {
KubeClient *kubernetes.Clientset
RestClient *rest.RESTClient
EtcdClient etcdclient.KeysAPI
TeamsAPIClient *teams.TeamsAPI
TeamsAPIClient *teams.API
InfrastructureRoles map[string]spec.PgUser
}
@@ -30,7 +30,6 @@ type Controller struct {
Config
opConfig *config.Config
logger *logrus.Entry
waitCluster sync.WaitGroup
clustersMu sync.RWMutex
clusters map[spec.NamespacedName]*cluster.Cluster
+2 -2
View File
@@ -8,10 +8,10 @@ import (
)
func (c *Controller) initEtcdClient(etcdHost string) error {
etcdUrl := fmt.Sprintf("http://%s", etcdHost)
etcdURL := fmt.Sprintf("http://%s", etcdHost)
cfg, err := etcdclient.New(etcdclient.Config{
Endpoints: []string{etcdUrl},
Endpoints: []string{etcdURL},
Transport: etcdclient.DefaultTransport,
HeaderTimeoutPerRequest: time.Second,
})
+4 -4
View File
@@ -209,18 +209,18 @@ func (c *Controller) queueClusterEvent(old, new *spec.Postgresql, eventType spec
return
}
workerId := c.clusterWorkerId(clusterName)
workerID := c.clusterWorkerID(clusterName)
clusterEvent := spec.ClusterEvent{
EventType: eventType,
UID: uid,
OldSpec: old,
NewSpec: new,
WorkerID: workerId,
WorkerID: workerID,
}
//TODO: if we delete cluster, discard all the previous events for the cluster
c.clusterEventQueues[workerId].Add(clusterEvent)
c.logger.WithField("worker", workerId).Infof("%s of the '%s' cluster has been queued for", eventType, clusterName)
c.clusterEventQueues[workerID].Add(clusterEvent)
c.logger.WithField("worker", workerID).Infof("%s of the '%s' cluster has been queued for", eventType, clusterName)
}
func (c *Controller) postgresqlAdd(obj interface{}) {
+2 -3
View File
@@ -62,7 +62,7 @@ func thirdPartyResource(TPRName string) *extv1beta.ThirdPartyResource {
}
}
func (c *Controller) clusterWorkerId(clusterName spec.NamespacedName) uint32 {
func (c *Controller) clusterWorkerID(clusterName spec.NamespacedName) uint32 {
return crc32.ChecksumIEEE([]byte(clusterName.String())) % c.opConfig.Workers
}
@@ -74,9 +74,8 @@ func (c *Controller) createTPR() error {
if err != nil {
if !k8sutil.ResourceAlreadyExists(err) {
return err
} else {
c.logger.Infof("ThirdPartyResource '%s' is already registered", TPRName)
}
c.logger.Infof("ThirdPartyResource '%s' is already registered", TPRName)
} else {
c.logger.Infof("ThirdPartyResource '%s' has been registered", TPRName)
}