Fix golangci-lint linter report
authorSofian Brabez <sbz@6dev.net>
Thu, 28 Feb 2019 15:27:07 +0000 (15:27 +0000)
committerSofian Brabez <sbz@6dev.net>
Thu, 28 Feb 2019 15:27:07 +0000 (15:27 +0000)
aws.go
aws_test.go
etcd.go
slackapi.go
vault.go

diff --git a/aws.go b/aws.go
index e3b6d2c1656d22baa30194183c597ef8fb1c5c85..0af10002ce2b6a67cf2a3ea90fd070833d5907e7 100644 (file)
--- a/aws.go
+++ b/aws.go
@@ -15,7 +15,7 @@ var (
        errInvalidFilter         = errors.New("invalid filter map input")
        errMissingKeyNameFilter  = errors.New("filter doesn't have 'Name' key")
        errMissingKeyValueFilter = errors.New("filter doesn't have 'Value' key")
-       errNoExistingInstances   = errors.New("no exisiting instances returned")
+       errNoExistingInstances   = errors.New("no existing instances returned")
 )
 
 type Service interface {
@@ -30,7 +30,7 @@ func (a *AWSService) GetInstancesPrivateIps(filter map[string]string) ([]string,
        var name, value string
        var ok bool
 
-       if filter == nil {
+       if len(filter) == 0 {
                return nil, errInvalidFilter
        }
 
index 353d1e921bebe7515ce0220f09f4d44fc7b8aa99..5cb6cf0b25b6b26407c9fd814c0c1eac1058f233 100644 (file)
@@ -15,13 +15,13 @@ func init() {
 type mockService struct{}
 
 func (s *mockService) DescribeInstances(*ec2.DescribeInstancesInput) (*ec2.DescribeInstancesOutput, error) {
-       privateIp := "172.16.1.2"
+       privateIP := "172.16.1.2"
        mockResult := ec2.DescribeInstancesOutput{
                Reservations: []*ec2.Reservation{
                        {
                                Instances: []*ec2.Instance{
                                        {
-                                               PrivateIpAddress: &privateIp,
+                                               PrivateIpAddress: &privateIP,
                                        },
                                },
                        },
diff --git a/etcd.go b/etcd.go
index 742f95c15d16eeb1d57d17ca87e222f0170411a8..80eae0e653b6c0998702e3a088cd9e79af018ea7 100644 (file)
--- a/etcd.go
+++ b/etcd.go
@@ -99,8 +99,8 @@ func (e *Etcd) CheckCluster() (bool, error) {
        return ensureMembersAlive(alives), nil
 }
 
-func getMemberHealth(memberUrl string) bool {
-       url := memberUrl + "/health"
+func getMemberHealth(memberURL string) bool {
+       url := memberURL + "/health"
        cnx := NewConnection(url)
        log.Debugf("Etcd Member connection on %s", url)
        resp, err := cnx.Get()
index 8db97b8740ebd05284d4d0a37d330a6ce16cb729..08410443a88def760943f4891794b4052e271c0c 100644 (file)
@@ -7,20 +7,20 @@ import (
 )
 
 type SlackClient struct {
-       url        string
-       channel    string
-       username   string
-       icon       string
-       link_names int
+       url       string
+       channel   string
+       username  string
+       icon      string
+       linkNames int
 }
 
-func NewSlackClient(url, channel, username, icon string, link_names int) *SlackClient {
+func NewSlackClient(url, channel, username, icon string, linkNames int) *SlackClient {
        return &SlackClient{
-               url:        url,
-               channel:    channel,
-               username:   username,
-               icon:       icon,
-               link_names: link_names,
+               url:       url,
+               channel:   channel,
+               username:  username,
+               icon:      icon,
+               linkNames: linkNames,
        }
 }
 
@@ -45,7 +45,7 @@ func (s *SlackClient) Send(message string) error {
        }{
                message,
                s.channel,
-               s.link_names,
+               s.linkNames,
                s.username,
                s.icon,
        }
index a7fbd3005140e94e7361994eeff4f5370edb5705..a560b337d618d727630e50ec4978e0e120e344ba 100644 (file)
--- a/vault.go
+++ b/vault.go
@@ -58,8 +58,8 @@ func (v *Vault) CheckCluster() (bool, error) {
                return false, err
        }
 
-       for _, nodeIp := range vaultNodeIps {
-               healthURL := url.URL{Scheme: "https", Host: nodeIp + ":8200", Path: HealthEndpointURL}
+       for _, nodeIP := range vaultNodeIps {
+               healthURL := url.URL{Scheme: "https", Host: nodeIP + ":8200", Path: HealthEndpointURL}
                if sealed, err := isSealed(healthURL.String()); sealed {
                        return false, err
                }