Skip to content

Commit

Permalink
goreport: fix mispells and ineffectual assignments
Browse files Browse the repository at this point in the history
  • Loading branch information
lebauce committed Jun 26, 2018
1 parent 270f574 commit 4618644
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cmd/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const (
)

// LoadConfiguration from a configuration file
// If no configuration file are given, try to load the default configuraiton file /etc/skydive/skydive.yml
// If no configuration file are given, try to load the default configuration file /etc/skydive/skydive.yml
func LoadConfiguration(cfgBackend string, cfgFiles []string) error {
if len(cfgFiles) == 0 {
config.InitConfig(cfgBackend, []string{DefaultConfigurationFile})
Expand Down
2 changes: 1 addition & 1 deletion flow/flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ func GetFirstLayerType(encapType string) (gopacket.LayerType, layers.LinkType) {
}
}

// LayersPath returns path and the appication of all the layers separated by a slash.
// LayersPath returns path and the application of all the layers separated by a slash.
func LayersPath(ls []gopacket.Layer) (string, string) {
var app, path string
for i, layer := range ls {
Expand Down
2 changes: 1 addition & 1 deletion flow/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (fm *FlowMetric) Add(m common.Metric) common.Metric {
}
}

// Sub substracts flow metrics
// Sub subtracts flow metrics
func (fm *FlowMetric) Sub(m common.Metric) common.Metric {
f2 := m.(*FlowMetric)

Expand Down
1 change: 0 additions & 1 deletion flow/storage/orientdb/orientdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@ func (c *OrientDBStorage) SearchRawPackets(fsq filters.SearchQuery, packetFilter
sql += " AND " + conditional
} else {
sql += " WHERE " + conditional
where = true
}
}

Expand Down
2 changes: 1 addition & 1 deletion http/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func (s *Server) readStatics(upath string) (content []byte, err error) {
logging.GetLogger().Debugf("Fetch disk asset: %s", upath)
content = asset.Content
} else if content, err = statics.Asset(upath); err != nil {
logging.GetLogger().Debugf("Fetch embeded asset: %s", upath)
logging.GetLogger().Debugf("Fetch embedded asset: %s", upath)
}
return
}
Expand Down
5 changes: 4 additions & 1 deletion storage/orientdb/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,8 +582,11 @@ func (c *Client) Query(obj string, query *filters.SearchQuery, result interface{
func (c *Client) Connect() error {
url := fmt.Sprintf("%s/connect/%s", c.url, c.database)
request, err := http.NewRequest("GET", url, nil)
request.SetBasicAuth(c.username, c.password)
if err != nil {
return err
}

request.SetBasicAuth(c.username, c.password)
resp, err := c.client.Do(request)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion tests/elasticsearch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ func TestElasticsearchMappings(t *testing.T) {

mappings, err := client.GetClient().GetMapping().Index(client.GetIndexAlias()).Do(context.Background())
if err != nil {
t.Fatalf("Failed to retreive mappings: %s", err.Error())
t.Fatalf("Failed to retrieve mappings: %s", err.Error())
}

for indexName, doc := range mappings {
Expand Down
2 changes: 1 addition & 1 deletion tests/flow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ func queryFlowMetrics(gh *gclient.GremlinQueryHelper, bridge string, timeContext
}

metric, err = gh.GetFlowMetric(gremlin.Has("Metric.ABBytes", g.Between(pingLen, pingLen+1)))
if metric == nil || metric.ABBytes <= pingLen-1 || metric.ABBytes >= pingLen+1 {
if err != nil || metric == nil || metric.ABBytes <= pingLen-1 || metric.ABBytes >= pingLen+1 {
return fmt.Errorf("Number of bytes is wrong, got: %v", metric)
}

Expand Down
4 changes: 4 additions & 0 deletions tests/tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ func (c *TestContext) getWholeGraph(t *testing.T, at time.Time) string {
}

b, err := ioutil.ReadAll(resp.Body)
if err != nil {
t.Error(err)
return ""
}
resp.Body.Close()

cmd := exec.Command("graph-easy", "--as_ascii")
Expand Down
6 changes: 5 additions & 1 deletion tests/topology_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ func TestInterfaceMetrics(t *testing.T) {
tx += im.TxPackets
}

// due to ratio applied during the aggregation we can't expect to get excatly
// due to ratio applied during the aggregation we can't expect to get exactly
// the sum of the metrics.
if tx <= 25 {
return fmt.Errorf("Expected at least TxPackets, got %d", tx)
Expand Down Expand Up @@ -782,6 +782,10 @@ func TestRouteTable(t *testing.T) {
)

node, err = c.gh.GetNode(prefix.V().Has("IPV4", "124.65.91.42/24"))
if err != nil {
return fmt.Errorf("Failed to find a node with IP 124.65.91.42/24")
}

routingTable = node.Metadata()["RoutingTable"].([]interface{})
newNoOfRoutingTable := len(routingTable)

Expand Down
2 changes: 1 addition & 1 deletion topology/graph/indexer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func TestMetadataIndexer(t *testing.T) {

g.NewNode(GenID(), m5, "host")

nodes, values = dockerCache.Get("kube-system", "mypod", "mycontainer")
nodes, _ = dockerCache.Get("kube-system", "mypod", "mycontainer")
if len(nodes) != 1 {
t.Errorf("Expected 1 one, got %+v", nodes)
}
Expand Down

0 comments on commit 4618644

Please sign in to comment.