From d2e37f8c7ddef0535a6e738e1c7e7eab1498a528 Mon Sep 17 00:00:00 2001 From: Julian Kornberger Date: Sat, 13 Jan 2018 16:40:23 +0100 Subject: [PATCH] Simplify with `gofmt -s -w .` --- database/all/internel_test.go | 12 ++++---- database/influxdb/node_test.go | 14 ++++----- output/all/filter_test.go | 4 +-- output/all/output_test.go | 12 ++++---- output/meshviewer-ffrgb/meshviewer_test.go | 36 +++++++++++----------- output/meshviewer-ffrgb/struct_test.go | 6 ++-- runtime/nodes_test.go | 4 +-- runtime/stats.go | 2 +- 8 files changed, 45 insertions(+), 45 deletions(-) diff --git a/database/all/internel_test.go b/database/all/internel_test.go index e3981db..ea9264e 100644 --- a/database/all/internel_test.go +++ b/database/all/internel_test.go @@ -25,27 +25,27 @@ func TestStart(t *testing.T) { DeleteInterval: duration.Duration{Duration: time.Millisecond}, Connection: map[string]interface{}{ "a": []map[string]interface{}{ - map[string]interface{}{ + { "enable": false, "path": "a1", }, - map[string]interface{}{ + { "path": "a2", }, - map[string]interface{}{ + { "enable": true, "path": "a3", }, }, "b": nil, "c": []map[string]interface{}{ - map[string]interface{}{ + { "path": "c1", }, }, // fetch continue command in Connect "d": []map[string]interface{}{ - map[string]interface{}{ + { "path": "d0", }, }, @@ -57,7 +57,7 @@ func TestStart(t *testing.T) { // connection type not found _, err = Connect(map[string]interface{}{ "e": []map[string]interface{}{ - map[string]interface{}{}, + {}, }, }) assert.Error(err) diff --git a/database/influxdb/node_test.go b/database/influxdb/node_test.go index caf6299..ffaac4c 100644 --- a/database/influxdb/node_test.go +++ b/database/influxdb/node_test.go @@ -35,12 +35,12 @@ func TestToInflux(t *testing.T) { }, MeshVPN: &data.MeshVPN{ Groups: map[string]*data.MeshVPNPeerGroup{ - "ffhb": &data.MeshVPNPeerGroup{ + "ffhb": { Peers: map[string]*data.MeshVPNPeerLink{ - "vpn01": &data.MeshVPNPeerLink{Established: 3}, - "vpn02": &data.MeshVPNPeerLink{}, + "vpn01": {Established: 3}, + "vpn02": {}, "trash": nil, - "vpn03": &data.MeshVPNPeerLink{Established: 0}, + "vpn03": {Established: 0}, }, }, }, @@ -74,16 +74,16 @@ func TestToInflux(t *testing.T) { Neighbours: &data.Neighbours{ NodeID: "deadbeef", Batadv: map[string]data.BatadvNeighbours{ - "a-interface": data.BatadvNeighbours{ + "a-interface": { Neighbours: map[string]data.BatmanLink{ - "BAFF1E5": data.BatmanLink{ + "BAFF1E5": { Tq: 204, }, }, }, }, LLDP: map[string]data.LLDPNeighbours{ - "b-interface": data.LLDPNeighbours{}, + "b-interface": {}, }, }, } diff --git a/output/all/filter_test.go b/output/all/filter_test.go index 9a55333..d94c2b2 100644 --- a/output/all/filter_test.go +++ b/output/all/filter_test.go @@ -14,7 +14,7 @@ func TestFilter(t *testing.T) { // filtered - do not run all nodes := &runtime.Nodes{ List: map[string]*runtime.Node{ - "a": &runtime.Node{ + "a": { Nodeinfo: &data.NodeInfo{NodeID: "a"}, }, }, @@ -28,7 +28,7 @@ func TestFilter(t *testing.T) { // run to end nodes = &runtime.Nodes{ List: map[string]*runtime.Node{ - "a": &runtime.Node{ + "a": { Nodeinfo: &data.NodeInfo{NodeID: "a"}, }, }, diff --git a/output/all/output_test.go b/output/all/output_test.go index 7f77299..0373df4 100644 --- a/output/all/output_test.go +++ b/output/all/output_test.go @@ -50,28 +50,28 @@ func TestStart(t *testing.T) { }) allOutput, err := Register(map[string]interface{}{ "a": []map[string]interface{}{ - map[string]interface{}{ + { "enable": false, "path": "a1", }, - map[string]interface{}{ + { "path": "a2", }, - map[string]interface{}{ + { "enable": true, "path": "a3", }, }, "b": nil, "c": []map[string]interface{}{ - map[string]interface{}{ + { "path": "c1", "filter": map[string]interface{}{}, }, }, // fetch continue command in Connect "d": []map[string]interface{}{ - map[string]interface{}{ + { "path": "d0", }, }, @@ -84,7 +84,7 @@ func TestStart(t *testing.T) { _, err = Register(map[string]interface{}{ "e": []map[string]interface{}{ - map[string]interface{}{}, + {}, }, }) assert.Error(err) diff --git a/output/meshviewer-ffrgb/meshviewer_test.go b/output/meshviewer-ffrgb/meshviewer_test.go index 90c2ee5..80f8083 100644 --- a/output/meshviewer-ffrgb/meshviewer_test.go +++ b/output/meshviewer-ffrgb/meshviewer_test.go @@ -19,7 +19,7 @@ func TestTransform(t *testing.T) { Network: data.Network{ Mac: "node:a:mac", Mesh: map[string]*data.BatInterface{ - "bat0": &data.BatInterface{ + "bat0": { Interfaces: struct { Wireless []string `json:"wireless,omitempty"` Other []string `json:"other,omitempty"` @@ -36,14 +36,14 @@ func TestTransform(t *testing.T) { Neighbours: &data.Neighbours{ NodeID: "node_a", Batadv: map[string]data.BatadvNeighbours{ - "node:a:mac:wifi": data.BatadvNeighbours{ + "node:a:mac:wifi": { Neighbours: map[string]data.BatmanLink{ - "node:b:mac:wifi": data.BatmanLink{Tq: 153}, + "node:b:mac:wifi": {Tq: 153}, }, }, - "node:a:mac:lan": data.BatadvNeighbours{ + "node:a:mac:lan": { Neighbours: map[string]data.BatmanLink{ - "node:b:mac:lan": data.BatmanLink{Tq: 51}, + "node:b:mac:lan": {Tq: 51}, }, }, }, @@ -56,7 +56,7 @@ func TestTransform(t *testing.T) { Network: data.Network{ Mac: "node:c:mac", Mesh: map[string]*data.BatInterface{ - "bat0": &data.BatInterface{ + "bat0": { Interfaces: struct { Wireless []string `json:"wireless,omitempty"` Other []string `json:"other,omitempty"` @@ -71,9 +71,9 @@ func TestTransform(t *testing.T) { Neighbours: &data.Neighbours{ NodeID: "node_b", Batadv: map[string]data.BatadvNeighbours{ - "node:c:mac:lan": data.BatadvNeighbours{ + "node:c:mac:lan": { Neighbours: map[string]data.BatmanLink{ - "node:b:mac:lan": data.BatmanLink{Tq: 102}, + "node:b:mac:lan": {Tq: 102}, }, }, }, @@ -86,7 +86,7 @@ func TestTransform(t *testing.T) { Network: data.Network{ Mac: "node:b:mac", Mesh: map[string]*data.BatInterface{ - "bat0": &data.BatInterface{ + "bat0": { Interfaces: struct { Wireless []string `json:"wireless,omitempty"` Other []string `json:"other,omitempty"` @@ -102,14 +102,14 @@ func TestTransform(t *testing.T) { Neighbours: &data.Neighbours{ NodeID: "node_b", Batadv: map[string]data.BatadvNeighbours{ - "node:b:mac:lan": data.BatadvNeighbours{ + "node:b:mac:lan": { Neighbours: map[string]data.BatmanLink{ - "node:c:mac:lan": data.BatmanLink{Tq: 204}, + "node:c:mac:lan": {Tq: 204}, }, }, - "node:b:mac:wifi": data.BatadvNeighbours{ + "node:b:mac:wifi": { Neighbours: map[string]data.BatmanLink{ - "node:a:mac:wifi": data.BatmanLink{Tq: 204}, + "node:a:mac:wifi": {Tq: 204}, }, }, }, @@ -122,7 +122,7 @@ func TestTransform(t *testing.T) { Network: data.Network{ Mac: "node:d:mac", Mesh: map[string]*data.BatInterface{ - "bat0": &data.BatInterface{ + "bat0": { Interfaces: struct { Wireless []string `json:"wireless,omitempty"` Other []string `json:"other,omitempty"` @@ -138,14 +138,14 @@ func TestTransform(t *testing.T) { Neighbours: &data.Neighbours{ NodeID: "node_d", Batadv: map[string]data.BatadvNeighbours{ - "node:d:mac:lan": data.BatadvNeighbours{ + "node:d:mac:lan": { Neighbours: map[string]data.BatmanLink{ - "node:c:mac:lan": data.BatmanLink{Tq: 204}, + "node:c:mac:lan": {Tq: 204}, }, }, - "node:d:mac:wifi": data.BatadvNeighbours{ + "node:d:mac:wifi": { Neighbours: map[string]data.BatmanLink{ - "node:a:mac:wifi": data.BatmanLink{Tq: 204}, + "node:a:mac:wifi": {Tq: 204}, }, }, }, diff --git a/output/meshviewer-ffrgb/struct_test.go b/output/meshviewer-ffrgb/struct_test.go index 162c2d9..51960cf 100644 --- a/output/meshviewer-ffrgb/struct_test.go +++ b/output/meshviewer-ffrgb/struct_test.go @@ -30,15 +30,15 @@ func TestRegister(t *testing.T) { Total: 50, }, Wireless: []*data.WirelessAirtime{ - &data.WirelessAirtime{ + { ChanUtil: 0.3, Frequency: 2512, }, - &data.WirelessAirtime{ + { ChanUtil: 0.4, Frequency: 2612, }, - &data.WirelessAirtime{ + { ChanUtil: 0.5, Frequency: 5200, }, diff --git a/runtime/nodes_test.go b/runtime/nodes_test.go index 9b88503..05401da 100644 --- a/runtime/nodes_test.go +++ b/runtime/nodes_test.go @@ -176,9 +176,9 @@ func TestLinksNodes(t *testing.T) { Neighbours: &data.Neighbours{ NodeID: "f4f26dd7a30b", Batadv: map[string]data.BatadvNeighbours{ - "f4:f2:6d:d7:a3:0b": data.BatadvNeighbours{ + "f4:f2:6d:d7:a3:0b": { Neighbours: map[string]data.BatmanLink{ - "f4:f2:6d:d7:a3:0a": data.BatmanLink{ + "f4:f2:6d:d7:a3:0a": { Tq: 200, Lastseen: 0.42, }, }, diff --git a/runtime/stats.go b/runtime/stats.go index a17975d..506a0f9 100644 --- a/runtime/stats.go +++ b/runtime/stats.go @@ -2,7 +2,7 @@ package runtime const ( DISABLED_AUTOUPDATER = "disabled" - GLOBAL_SITE = "global" + GLOBAL_SITE = "global" ) // CounterMap to manage multiple values