Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
#626: Address gofmt issues as reported by goreportcard.com
Browse files Browse the repository at this point in the history
  • Loading branch information
geauxvirtual committed Dec 10, 2015
1 parent 1f73420 commit 32838b8
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 25 deletions.
24 changes: 12 additions & 12 deletions control/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ func TestMetricCatalog(t *testing.T) {
ts := time.Now()
Convey("add multiple metricTypes and get them back", func() {
ns := [][]string{
[]string{"test1"},
[]string{"test2"},
[]string{"test3"},
{"test1"},
{"test2"},
{"test3"},
}
lp := new(loadedPlugin)
mt := []*metricType{
Expand Down Expand Up @@ -180,9 +180,9 @@ func TestMetricCatalog(t *testing.T) {
})
Convey("metricCatalog.Item()", t, func() {
ns := [][]string{
[]string{"test1"},
[]string{"test2"},
[]string{"test3"},
{"test1"},
{"test2"},
{"test3"},
}
lp := new(loadedPlugin)
t := time.Now()
Expand Down Expand Up @@ -221,9 +221,9 @@ func TestMetricCatalog(t *testing.T) {

func TestSubscribe(t *testing.T) {
ns := [][]string{
[]string{"test1"},
[]string{"test2"},
[]string{"test3"},
{"test1"},
{"test2"},
{"test3"},
}
lp := new(loadedPlugin)
ts := time.Now()
Expand Down Expand Up @@ -255,9 +255,9 @@ func TestSubscribe(t *testing.T) {

func TestUnsubscribe(t *testing.T) {
ns := [][]string{
[]string{"test1"},
[]string{"test2"},
[]string{"test3"},
{"test1"},
{"test2"},
{"test3"},
}
lp := new(loadedPlugin)
ts := time.Now()
Expand Down
2 changes: 1 addition & 1 deletion control/plugin/collector_proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (p *mockPlugin) GetMetricTypes(cfg PluginConfigType) ([]PluginMetricType, e

func (p *mockPlugin) CollectMetrics(mockPluginMetricTypes []PluginMetricType) ([]PluginMetricType, error) {
for i := range mockPluginMetricTypes {
mockPluginMetricTypes[i].Labels_ = []core.Label{core.Label{Index: 0, Name: "test"}}
mockPluginMetricTypes[i].Labels_ = []core.Label{{Index: 0, Name: "test"}}
mockPluginMetricTypes[i].Tags_ = map[string]string{"key": "value"}
}
return mockPluginMetricTypes, nil
Expand Down
2 changes: 1 addition & 1 deletion control/plugin/collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (f *MockPlugin) CollectMetrics(_ []PluginMetricType) ([]PluginMetricType, e

func (c *MockPlugin) GetMetricTypes(_ PluginConfigType) ([]PluginMetricType, error) {
return []PluginMetricType{
PluginMetricType{Namespace_: []string{"foo", "bar"}},
{Namespace_: []string{"foo", "bar"}},
}, nil
}

Expand Down
2 changes: 1 addition & 1 deletion mgmt/rest/client/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func (g *GetMetricsResult) Len() int {

func convertCatalog(c *rbody.MetricsReturned) []*rbody.Metric {
mci := make([]*rbody.Metric, len(*c))
for i, _ := range *c {
for i := range *c {
mci[i] = &(*c)[i]
}
return mci
Expand Down
4 changes: 2 additions & 2 deletions mgmt/rest/client/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,15 @@ type AvailablePlugin struct {

func convertLoadedPlugins(r []rbody.LoadedPlugin) []LoadedPlugin {
lp := make([]LoadedPlugin, len(r))
for i, _ := range r {
for i := range r {
lp[i] = LoadedPlugin{&r[i]}
}
return lp
}

func convertAvailablePlugins(r []rbody.AvailablePlugin) []AvailablePlugin {
lp := make([]AvailablePlugin, len(r))
for i, _ := range r {
for i := range r {
lp[i] = AvailablePlugin{&r[i]}
}
return lp
Expand Down
2 changes: 1 addition & 1 deletion mgmt/rest/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ func (s *Server) unloadPlugin(w http.ResponseWriter, r *http.Request, p httprout
func (s *Server) getPlugins(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
var detail bool
// make this a function because DRY
for k, _ := range r.URL.Query() {
for k := range r.URL.Query() {
if k == "details" {
detail = true
}
Expand Down
2 changes: 1 addition & 1 deletion mgmt/rest/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ type TaskWatchHandler struct {

func (t *TaskWatchHandler) CatchCollection(m []core.Metric) {
sm := make([]rbody.StreamedMetric, len(m))
for i, _ := range m {
for i := range m {
sm[i] = rbody.StreamedMetric{
Namespace: core.JoinNamespace(m[i].Namespace()),
Data: m[i].Data(),
Expand Down
2 changes: 1 addition & 1 deletion mgmt/tribe/tribe.go
Original file line number Diff line number Diff line change
Expand Up @@ -1088,7 +1088,7 @@ func (t *tribe) handleMemberLeave(n *memberlist.Node) {
if m.PluginAgreement != nil {
delete(t.agreements[m.PluginAgreement.Name].Members, n.Name)
}
for k, _ := range m.TaskAgreements {
for k := range m.TaskAgreements {
delete(t.agreements[k].Members, n.Name)
}
delete(t.members, n.Name)
Expand Down
2 changes: 1 addition & 1 deletion plugin/collector/snap-collector-mock1/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (
var (
PluginName = "snap-collector-mock1"
PluginType = "collector"
SnapPath = os.Getenv("SNAP_PATH")
SnapPath = os.Getenv("SNAP_PATH")
PluginPath = path.Join(SnapPath, "plugin", PluginName)
)

Expand Down
2 changes: 1 addition & 1 deletion plugin/collector/snap-collector-mock1/mock/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (f *Mock) GetMetricTypes(cfg plugin.PluginConfigType) ([]plugin.PluginMetri
mts = append(mts, plugin.PluginMetricType{Namespace_: []string{"intel", "mock", "bar"}})
mts = append(mts, plugin.PluginMetricType{
Namespace_: []string{"intel", "mock", "*", "baz"},
Labels_: []core.Label{core.Label{Index: 2, Name: "host"}},
Labels_: []core.Label{{Index: 2, Name: "host"}},
})
return mts, nil
}
Expand Down
2 changes: 1 addition & 1 deletion plugin/collector/snap-collector-mock2/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (
var (
PluginName = "snap-collector-mock2"
PluginType = "collector"
SnapPath = os.Getenv("SNAP_PATH")
SnapPath = os.Getenv("SNAP_PATH")
PluginPath = path.Join(SnapPath, "plugin", PluginName)
)

Expand Down
2 changes: 1 addition & 1 deletion plugin/collector/snap-collector-mock2/mock/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (f *Mock) GetMetricTypes(cfg plugin.PluginConfigType) ([]plugin.PluginMetri
mts = append(mts, plugin.PluginMetricType{Namespace_: []string{"intel", "mock", "bar"}})
mts = append(mts, plugin.PluginMetricType{
Namespace_: []string{"intel", "mock", "*", "baz"},
Labels_: []core.Label{core.Label{Index: 2, Name: "host"}},
Labels_: []core.Label{{Index: 2, Name: "host"}},
})
return mts, nil
}
Expand Down
2 changes: 1 addition & 1 deletion plugin/publisher/snap-publisher-file/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (
var (
PluginName = "snap-publisher-file"
PluginType = "publisher"
SnapPath = os.Getenv("SNAP_PATH")
SnapPath = os.Getenv("SNAP_PATH")
PluginPath = path.Join(SnapPath, "plugin", PluginName)
)

Expand Down

0 comments on commit 32838b8

Please sign in to comment.