[SEBA-891] Resolve any lint violations in Redfish importer

Change-Id: Ie8e4ac360b9d2f986fc2161490407d9483eb26ce
diff --git a/Makefile b/Makefile
index 8df86dd..575cac2 100644
--- a/Makefile
+++ b/Makefile
@@ -82,7 +82,7 @@
 	chmod 755 $(GOPATH)/bin/hadolint
 endif
 	@echo "Running Dockerfile lint check ..."
-	@hadolint $$(find . -name "Dockerfile")
+	@hadolint $$(find .  -type f -not -path "./vendor/*"  -name "Dockerfile")
 	@echo "Dockerfile lint check OK"
 
 lint-style:
diff --git a/data_collector.go b/data_collector.go
index c626427..f1bc1b1 100644
--- a/data_collector.go
+++ b/data_collector.go
@@ -15,14 +15,14 @@
 package main
 
 import (
-	"net/http"
-	"fmt"
 	"encoding/json"
+	"fmt"
 	"io/ioutil"
+	"net/http"
 )
 
 /* parse_map() parses the json structure, amap, and returns all sub-folder paths found at the 2nd level of the multiplayer structure
-*/
+ */
 func parse_map(amap map[string]interface{}, level uint, archive map[string]bool) (paths []string) {
 	level = level + 1
 	for key, val := range amap {
@@ -35,7 +35,7 @@
 			paths = append(paths, p...)
 		default:
 			if level == 2 && key == "@odata.id" {
-			/* sub-folder path of a resource can be found as the value of the key '@odata.id' showing up at the 2nd level of the data read from a resource. When a path is found, it's checked against the array 'archive' to avoid duplicates. */
+				/* sub-folder path of a resource can be found as the value of the key '@odata.id' showing up at the 2nd level of the data read from a resource. When a path is found, it's checked against the array 'archive' to avoid duplicates. */
 				if _, ok := archive[val.(string)]; !ok {
 					archive[val.(string)] = true
 					paths = append(paths, val.(string))
@@ -47,7 +47,7 @@
 }
 
 /* parse_array() parses any vlaue, if in the form of an array, of a key-value pair found in the json structure, and returns any paths found.
-*/
+ */
 func parse_array(anarray []interface{}, level uint, archive map[string]bool) (paths []string) {
 	for _, val := range anarray {
 		switch val.(type) {
diff --git a/demo_test/cmd_client/cmd_cl.go b/demo_test/cmd_client/cmd_cl.go
index 2f8d865..067f8f4 100644
--- a/demo_test/cmd_client/cmd_cl.go
+++ b/demo_test/cmd_client/cmd_cl.go
@@ -29,13 +29,13 @@
 		fmt.Print("CMD to send : ")
 		text, _ := reader.ReadString('\n')
 		// send to socket
-		fmt.Fprintf(conn, text + "\n")
+		fmt.Fprintf(conn, text+"\n")
 
 		// listen for reply
 		message, _ = bufio.NewReader(conn).ReadString('\n')
 		fmt.Print("Return from server: " + message)
 
-		if message == "QUIT\n"{
+		if message == "QUIT\n" {
 			break
 		}
 	}
diff --git a/demo_test/test.go b/demo_test/test.go
index 168dad1..9fcd888 100644
--- a/demo_test/test.go
+++ b/demo_test/test.go
@@ -15,12 +15,12 @@
 package main
 
 import (
-	"github.com/opencord/device-management/demo_test/proto"
 	"bufio"
 	"bytes"
 	"crypto/tls"
 	"fmt"
 	"github.com/Shopify/sarama"
+	"github.com/opencord/device-management/demo_test/proto"
 	log "github.com/sirupsen/logrus"
 	"golang.org/x/net/context"
 	"google.golang.org/grpc"
@@ -51,7 +51,7 @@
 var conn *grpc.ClientConn
 
 func GetCurrentDevices() (error, []string) {
-	fmt.Println("Testing GetCurrentDevices\n")
+	fmt.Println("Testing GetCurrentDevices")
 	empty := new(importer.Empty)
 	var ret_msg *importer.DeviceListByIp
 	ret_msg, err := cc.GetCurrentDevices(ctx, empty)
@@ -73,7 +73,7 @@
 	log.Info("Starting topicListener for ", *topic)
 	consumer, err := master.ConsumePartition(*topic, 0, sarama.OffsetOldest)
 	if err != nil {
-		log.Error("topicListener panic, topic=[%s]: %s", *topic, err.Error())
+		log.Errorf("topicListener panic, topic=[%s]: %s", *topic, err.Error())
 		os.Exit(1)
 	}
 	signals := make(chan os.Signal, 1)
@@ -83,9 +83,9 @@
 		for {
 			select {
 			case err := <-consumer.Errors():
-				log.Error("Consumer error: %s", err.Err)
+				log.Errorf("Consumer error: %s", err.Err)
 			case msg := <-consumer.Messages():
-				log.Info("Got message on topic=[%s]: %s", *topic, string(msg.Value))
+				log.Infof("Got message on topic=[%s]: %s", *topic, string(msg.Value))
 			case <-signals:
 				log.Warn("Interrupt is detected")
 				os.Exit(1)
@@ -129,19 +129,19 @@
 	ln, err := net.Listen("tcp", ":9999")
 	if err != nil {
 		fmt.Println("could not listen")
-		log.Fatal("did not listen: %v", err)
+		log.Fatalf("did not listen: %v", err)
 	}
 	defer ln.Close()
 
 	connS, err := ln.Accept()
 	if err != nil {
 		fmt.Println("Accept error")
-		log.Fatal("Accept error: %v", err)
+		log.Fatalf("Accept error: %v", err)
 	}
 	conn, err = grpc.Dial(default_address, grpc.WithInsecure())
 	if err != nil {
 		fmt.Println("could not connect")
-		log.Fatal("did not connect: %v", err)
+		log.Fatalf("did not connect: %v", err)
 	}
 	defer conn.Close()
 
@@ -159,7 +159,7 @@
 
 		switch cmd {
 
-		case "attach" :
+		case "attach":
 			if len(s) < 2 {
 				newmessage = newmessage + "invalid command " + cmdstr + "\n"
 				break
@@ -175,7 +175,7 @@
 				deviceinfo := new(importer.DeviceInfo)
 				deviceinfo.IpAddress = info[0] + ":" + info[1]
 				freq, err := strconv.ParseUint(info[2], 10, 32)
-				if (err != nil) {
+				if err != nil {
 					newmessage = newmessage + "invalid command " + devinfo + "\n"
 					continue
 				}
@@ -192,7 +192,7 @@
 				ips := strings.Join(ipattached, " ")
 				newmessage = newmessage + ips + " attached\n"
 			}
-		case "delete" :
+		case "delete":
 			if len(s) < 2 {
 				newmessage = newmessage + "invalid command " + cmdstr + "\n"
 				break
@@ -210,7 +210,7 @@
 				ips := strings.Join(devicelist.Ip, " ")
 				newmessage = newmessage + ips + " deleted\n"
 			}
-		case "period" :
+		case "period":
 			if len(s) != 2 {
 				newmessage = newmessage + "invalid command " + cmdstr + "\n"
 				break
@@ -267,7 +267,7 @@
 				newmessage = newmessage + errStatus.Message()
 				fmt.Printf("Un/subscribe error - status code %v message %v", errStatus.Code(), errStatus.Message())
 			} else {
-				newmessage = newmessage + cmd +  " successful\n"
+				newmessage = newmessage + cmd + " successful\n"
 			}
 		case "showeventlist":
 			if len(s) != 2 {
@@ -320,30 +320,30 @@
 			loop = false
 			newmessage = "QUIT"
 
-			case "showdevices":
-				cmd_size := len(s)
-				fmt.Print("cmd is :", cmd, cmd_size)
-				if cmd_size > 2 || cmd_size < 0 {
-					fmt.Print("error event !!")
-					newmessage = "error event !!"
-				} else {
-					err, currentlist := GetCurrentDevices()
+		case "showdevices":
+			cmd_size := len(s)
+			fmt.Print("cmd is :", cmd, cmd_size)
+			if cmd_size > 2 || cmd_size < 0 {
+				fmt.Print("error event !!")
+				newmessage = "error event !!"
+			} else {
+				err, currentlist := GetCurrentDevices()
 
-					if err != nil {
-						errStatus, _ := status.FromError(err)
-						fmt.Println(errStatus.Message())
-						fmt.Println(errStatus.Code())
-						newmessage = errStatus.Message()
-						fmt.Print("showdevices error!!")
-					} else {
-						fmt.Print("showdevices ", currentlist)
-						newmessage = strings.Join(currentlist[:], ", ")
-					}
+				if err != nil {
+					errStatus, _ := status.FromError(err)
+					fmt.Println(errStatus.Message())
+					fmt.Println(errStatus.Code())
+					newmessage = errStatus.Message()
+					fmt.Print("showdevices error!!")
+				} else {
+					fmt.Print("showdevices ", currentlist)
+					newmessage = strings.Join(currentlist[:], ", ")
 				}
+			}
 		default:
 			newmessage = newmessage + "invalid command " + cmdstr + "\n"
 		}
-			// send string back to client
+		// send string back to client
 		connS.Write([]byte(newmessage + "\n"))
 	}
 }
diff --git a/event_subscriber.go b/event_subscriber.go
index d4b75a3..fd6e013 100644
--- a/event_subscriber.go
+++ b/event_subscriber.go
@@ -18,10 +18,10 @@
 	"bytes"
 	"encoding/json"
 	"fmt"
+	"io/ioutil"
 	"net/http"
 	"os"
 	"regexp"
-	"io/ioutil"
 )
 
 const RF_EVENTSERVICE = "/redfish/v1/EventService/"
@@ -92,7 +92,7 @@
 	return true
 }
 
-func (s *Server) get_event_types(ip string) (eventtypes []string ) {
+func (s *Server) get_event_types(ip string) (eventtypes []string) {
 	resp, err := http.Get(RF_DEFAULT_PROTOCOL + ip + RF_EVENTSERVICE)
 	fmt.Println("get_event_types")
 	if resp != nil {
diff --git a/main.go b/main.go
index 50f3c5b..4f05c88 100644
--- a/main.go
+++ b/main.go
@@ -15,13 +15,13 @@
 package main
 
 import (
-	"github.com/opencord/device-management/proto"
 	"crypto/tls"
 	"encoding/json"
 	"fmt"
 	"github.com/Shopify/sarama"
-	log "github.com/sirupsen/logrus"
 	empty "github.com/golang/protobuf/ptypes/empty"
+	"github.com/opencord/device-management/proto"
+	log "github.com/sirupsen/logrus"
 	"golang.org/x/net/context"
 	"google.golang.org/grpc"
 	"google.golang.org/grpc/codes"
@@ -47,34 +47,34 @@
 
 var DataProducer sarama.AsyncProducer
 
-var redfish_resources = [...]string{"/redfish/v1/Chassis", "/redfish/v1/Systems","/redfish/v1/EthernetSwitches"}
+var redfish_resources = [...]string{"/redfish/v1/Chassis", "/redfish/v1/Systems", "/redfish/v1/EthernetSwitches"}
 var pvmount = os.Getenv("DEVICE_MANAGEMENT_PVMOUNT")
 var subscriptionListPath string
 
-type scheduler struct  {
-	getdata *time.Ticker
-	quit chan bool
+type scheduler struct {
+	getdata    *time.Ticker
+	quit       chan bool
 	getdataend chan bool
 }
 
-type device struct  {
-	Subscriptions	map[string]string	`json:"ss"`
-	Freq		uint32			`json:"freq"`
-	Datacollector	scheduler		`json:"-"`
-	Freqchan	chan uint32		`json:"-"`
-	Eventtypes	[]string		`json:"eventtypes"`
-	Datafile	*os.File		`json:"-"`
+type device struct {
+	Subscriptions map[string]string `json:"ss"`
+	Freq          uint32            `json:"freq"`
+	Datacollector scheduler         `json:"-"`
+	Freqchan      chan uint32       `json:"-"`
+	Eventtypes    []string          `json:"eventtypes"`
+	Datafile      *os.File          `json:"-"`
 }
 
 type Server struct {
-	devicemap	map[string]*device
-	gRPCserver	*grpc.Server
-	dataproducer	sarama.AsyncProducer
-	httpclient	*http.Client
+	devicemap    map[string]*device
+	gRPCserver   *grpc.Server
+	dataproducer sarama.AsyncProducer
+	httpclient   *http.Client
 }
 
 func (s *Server) ClearCurrentEventList(c context.Context, info *importer.Device) (*empty.Empty, error) {
-	fmt.Println("Received ClearCurrentEventList\n")
+	fmt.Println("Received ClearCurrentEventList")
 	ip_address := info.IpAddress
 	_, found := s.devicemap[ip_address]
 	if !found {
@@ -93,7 +93,7 @@
 }
 
 func (s *Server) GetCurrentEventList(c context.Context, info *importer.Device) (*importer.EventList, error) {
-	fmt.Println("Received GetCurrentEventList\n")
+	fmt.Println("Received GetCurrentEventList")
 	_, found := s.devicemap[info.IpAddress]
 	if !found {
 		return nil, status.Errorf(codes.NotFound, "Device not registered")
@@ -106,9 +106,9 @@
 }
 
 func (s *Server) GetEventList(c context.Context, info *importer.Device) (*importer.EventList, error) {
-	fmt.Println("Received GetEventList\n")
+	fmt.Println("Received GetEventList")
 	eventstobesubscribed := new(importer.EventList)
-//	eventstobesubscribed.Events = s.devicemap[info.IpAddress].Eventtypes
+	//	eventstobesubscribed.Events = s.devicemap[info.IpAddress].Eventtypes
 	eventstobesubscribed.Events = s.get_event_types(info.IpAddress)
 	if eventstobesubscribed.Events == nil {
 		return nil, status.Errorf(codes.NotFound, "No events found")
@@ -133,7 +133,7 @@
 
 func (s *Server) SubsrcribeGivenEvents(c context.Context, subeventlist *importer.GivenEventList) (*empty.Empty, error) {
 	errstring := ""
-	fmt.Println("Received SubsrcribeEvents\n")
+	fmt.Println("Received SubsrcribeEvents")
 	//Call API to subscribe events
 	ip_address := subeventlist.EventIpAddress
 	_, found := s.devicemap[ip_address]
@@ -168,7 +168,7 @@
 
 func (s *Server) UnSubsrcribeGivenEvents(c context.Context, unsubeventlist *importer.GivenEventList) (*empty.Empty, error) {
 	errstring := ""
-	fmt.Println("Received UnSubsrcribeEvents\n")
+	fmt.Println("Received UnSubsrcribeEvents")
 	ip_address := unsubeventlist.EventIpAddress
 	_, found := s.devicemap[ip_address]
 	if !found {
@@ -246,7 +246,7 @@
 					b := []byte(str)
 					msg := &sarama.ProducerMessage{Topic: importerTopic, Value: sarama.StringEncoder(b)}
 					select {
-					case  s.dataproducer.Input() <- msg:
+					case s.dataproducer.Input() <- msg:
 						fmt.Println("Produce message")
 					default:
 					}
@@ -266,7 +266,7 @@
 	errstring := ""
 	for _, ip := range list.Ip {
 		if _, ok := s.devicemap[ip]; !ok {
-			fmt.Printf("Device not found ", ip)
+			fmt.Printf("Device not found %s\n ", ip)
 			errstring = errstring + "Device " + ip + " not found\n"
 			continue
 		}
@@ -305,10 +305,10 @@
 	return &empty.Empty{}, nil
 }
 
-func (s *Server) SendDeviceList(c context.Context,  list *importer.DeviceList) (*empty.Empty, error) {
+func (s *Server) SendDeviceList(c context.Context, list *importer.DeviceList) (*empty.Empty, error) {
 	errstring := ""
 	for _, dev := range list.Device {
-		ip_address:= dev.IpAddress
+		ip_address := dev.IpAddress
 		if _, ok := s.devicemap[dev.IpAddress]; ok {
 			fmt.Printf("Device %s already exists", ip_address)
 			errstring = errstring + "Device " + ip_address + " already exists\n"
@@ -320,11 +320,11 @@
 			errstring = errstring + "Device " + ip_address + " data collection frequency out of range\n"
 			continue
 		}
-		d := device {
+		d := device{
 			Subscriptions: make(map[string]string),
-			Freq: dev.Frequency,
+			Freq:          dev.Frequency,
 			Datacollector: scheduler{
-				quit: make(chan bool),
+				quit:       make(chan bool),
 				getdataend: make(chan bool),
 			},
 			Freqchan: make(chan uint32),
@@ -362,7 +362,7 @@
 }
 
 func (s *Server) GetCurrentDevices(c context.Context, e *importer.Empty) (*importer.DeviceListByIp, error) {
-	fmt.Println("In Received GetCurrentDevices\n")
+	fmt.Println("In Received GetCurrentDevices")
 
 	if len(s.devicemap) == 0 {
 		return nil, status.Errorf(codes.NotFound, "Devices not registered")
@@ -388,13 +388,13 @@
 	grpcport := ":50051"
 	listener, gserver, err := NewGrpcServer(grpcport)
 	if err != nil {
-		fmt.Println("Failed to create gRPC server: %v", err)
+		fmt.Println("Failed to create gRPC server: ", err)
 		return err
 	}
 	s.gRPCserver = gserver
 	importer.RegisterDeviceManagementServer(gserver, s)
 	if err := gserver.Serve(listener); err != nil {
-		fmt.Println("Failed to run gRPC server: %v", err)
+		fmt.Println("Failed to run gRPC server: ", err)
 		return err
 	}
 	return nil
@@ -523,9 +523,9 @@
 		Timeout: 10 * time.Second,
 	}
 
-	s := Server {
-		devicemap:	make(map[string]*device),
-		httpclient:	client,
+	s := Server{
+		devicemap:  make(map[string]*device),
+		httpclient: client,
 	}
 
 	s.kafkaInit()