Commit 980a2384 authored by Stefan Dähling's avatar Stefan Dähling
Browse files

fixes based on go report

parent f21d610d
Pipeline #249221 passed with stages
in 2 minutes and 52 seconds
......@@ -74,7 +74,7 @@ type ACL struct {
// commData stores data about communication with other agent
type commData struct {
numMsgSent int // number of messages sent to this agent
numMsgRecv int // number of messages recived from this agent
numMsgRecv int // number of messages received from this agent
}
// newACL creates a new ACL object
......
......@@ -269,7 +269,7 @@ func (stor *etcdStorage) deleteMAS(masID int) (err error) {
return
}
// addAgent adds an agent to an exsiting MAS
// addAgent adds an agent to an existing MAS
func (stor *etcdStorage) addAgent(masID int, agentSpec schemas.AgentSpec) (err error) {
return
}
......
......@@ -207,7 +207,7 @@ func (kube *kubeDeplyoment) createStatefulSet(masID int, image string, registry
},
},
}
serv, err = servicesClient.Create(serv)
_, err = servicesClient.Create(serv)
if err != nil {
return
}
......@@ -329,7 +329,7 @@ func (kube *kubeDeplyoment) createStatefulSet(masID int, image string, registry
},
}
statefulsetclient := kube.clientset.Apps().StatefulSets("clonemap")
statefulset, err = statefulsetclient.Create(statefulset)
_, err = statefulsetclient.Create(statefulset)
}
return
}
......
......@@ -45,7 +45,7 @@ THE SOFTWARE.
package ams
// gives an interface for interaction with the storage (local or etcd). The Storage
// stores the state of the AMS. This is MAS configuartion and MAS and agent status
// stores the state of the AMS. This is MAS configuration and MAS and agent status
import (
"errors"
......@@ -98,7 +98,7 @@ type storage interface {
// deleteMAS deletes MAS with specified ID
deleteMAS(masID int) (err error)
// addAgent adds an agent to an exsiting MAS
// addAgent adds an agent to an existing MAS
addAgent(masID int, agentSpec schemas.AgentSpec) (err error)
}
......@@ -106,7 +106,7 @@ type storage interface {
type CommData struct {
ID int // id of other agent
NumMsgSent int // number of messages sent to this agent
NumMsgRecv int // number of messages recived from this agent
NumMsgRecv int // number of messages received from this agent
}
// information storage for local use of clonemap
......@@ -385,7 +385,7 @@ func (stor *localStorage) deleteMAS(masID int) (err error) {
return
}
// addAgent adds an agent to an exsiting MAS
// addAgent adds an agent to an existing MAS
func (stor *localStorage) addAgent(masID int, agentSpec schemas.AgentSpec) (err error) {
return
}
......
......@@ -128,7 +128,7 @@ func Get(client *http.Client, url string, delay time.Duration, numRetries int) (
//Delete sends a delete request and retries in case of an error
func Delete(client *http.Client, url string, body io.Reader, delay time.Duration,
numRetries int) (httpStatus int, err error) {
request := &http.Request{}
var request *http.Request
request, err = http.NewRequest("DELETE", url, nil)
resp := &http.Response{}
resp, err = client.Do(request)
......@@ -156,7 +156,7 @@ func Delete(client *http.Client, url string, body io.Reader, delay time.Duration
//Put sends a post request and retries in case of an error
func Put(client *http.Client, url string, content []byte, delay time.Duration,
numRetries int) (body []byte, httpStatus int, err error) {
request := &http.Request{}
var request *http.Request
request, err = http.NewRequest("PUT", url, bytes.NewReader(content))
resp := &http.Response{}
resp, err = client.Do(request)
......
......@@ -282,14 +282,19 @@ func (stor *etcdStorage) handleDFEvents() {
if len(path) == 3 {
if path[1] == "graph" {
err = stor.handleGraphEvents(masID, event.Kv)
if err != nil {
stor.logError.Println(err)
continue
}
}
} else if len(path) == 5 {
if path[1] == "mas" && path[3] == "svc" {
svcID := path[4]
err = stor.handleSvcEvents(masID, svcID, event.Kv)
if err != nil {
stor.logError.Println(err)
continue
}
err = stor.handleSvcEvents(masID, svcID, event.Kv)
}
}
}
......
......@@ -245,7 +245,7 @@ func (stor *localStorage) searchServices(masID int, desc string) (svc []schemas.
// searchLocalServices searches all services within a certain range from specified node
func (stor *localStorage) searchLocalServices(masID int, nodeID int, dist float64,
desc string) (svc []schemas.Service, err error) {
nodes := make(map[int]float64)
var nodes map[int]float64
stor.mutex.Lock()
numMAS := len(stor.mas)
stor.mutex.Unlock()
......
......@@ -52,7 +52,7 @@ import (
type LogConfig struct {
Msg bool `json:"msg"` // activation of msg log topic
App bool `json:"app"` // activation of app log topic
Status bool `json:"status"` // actication of status log topic
Status bool `json:"status"` // activation of status log topic
Debug bool `json:"debug"` // activation of debug log topic
}
......@@ -78,5 +78,5 @@ type State struct {
type Communication struct {
ID int `json:"id"` // id of other agent
NumMsgSent int `json:"numsent"` // number of messages sent to this agent
NumMsgRecv int `json:"numrecv"` // number of messages recived from this agent
NumMsgRecv int `json:"numrecv"` // number of messages received from this agent
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment