Simplify with `gofmt -s -w .`

This commit is contained in:
Julian Kornberger 2018-01-13 16:40:23 +01:00
parent 32d11421d3
commit d2e37f8c7d
8 changed files with 45 additions and 45 deletions

View File

@ -25,27 +25,27 @@ func TestStart(t *testing.T) {
DeleteInterval: duration.Duration{Duration: time.Millisecond}, DeleteInterval: duration.Duration{Duration: time.Millisecond},
Connection: map[string]interface{}{ Connection: map[string]interface{}{
"a": []map[string]interface{}{ "a": []map[string]interface{}{
map[string]interface{}{ {
"enable": false, "enable": false,
"path": "a1", "path": "a1",
}, },
map[string]interface{}{ {
"path": "a2", "path": "a2",
}, },
map[string]interface{}{ {
"enable": true, "enable": true,
"path": "a3", "path": "a3",
}, },
}, },
"b": nil, "b": nil,
"c": []map[string]interface{}{ "c": []map[string]interface{}{
map[string]interface{}{ {
"path": "c1", "path": "c1",
}, },
}, },
// fetch continue command in Connect // fetch continue command in Connect
"d": []map[string]interface{}{ "d": []map[string]interface{}{
map[string]interface{}{ {
"path": "d0", "path": "d0",
}, },
}, },
@ -57,7 +57,7 @@ func TestStart(t *testing.T) {
// connection type not found // connection type not found
_, err = Connect(map[string]interface{}{ _, err = Connect(map[string]interface{}{
"e": []map[string]interface{}{ "e": []map[string]interface{}{
map[string]interface{}{}, {},
}, },
}) })
assert.Error(err) assert.Error(err)

View File

@ -35,12 +35,12 @@ func TestToInflux(t *testing.T) {
}, },
MeshVPN: &data.MeshVPN{ MeshVPN: &data.MeshVPN{
Groups: map[string]*data.MeshVPNPeerGroup{ Groups: map[string]*data.MeshVPNPeerGroup{
"ffhb": &data.MeshVPNPeerGroup{ "ffhb": {
Peers: map[string]*data.MeshVPNPeerLink{ Peers: map[string]*data.MeshVPNPeerLink{
"vpn01": &data.MeshVPNPeerLink{Established: 3}, "vpn01": {Established: 3},
"vpn02": &data.MeshVPNPeerLink{}, "vpn02": {},
"trash": nil, "trash": nil,
"vpn03": &data.MeshVPNPeerLink{Established: 0}, "vpn03": {Established: 0},
}, },
}, },
}, },
@ -74,16 +74,16 @@ func TestToInflux(t *testing.T) {
Neighbours: &data.Neighbours{ Neighbours: &data.Neighbours{
NodeID: "deadbeef", NodeID: "deadbeef",
Batadv: map[string]data.BatadvNeighbours{ Batadv: map[string]data.BatadvNeighbours{
"a-interface": data.BatadvNeighbours{ "a-interface": {
Neighbours: map[string]data.BatmanLink{ Neighbours: map[string]data.BatmanLink{
"BAFF1E5": data.BatmanLink{ "BAFF1E5": {
Tq: 204, Tq: 204,
}, },
}, },
}, },
}, },
LLDP: map[string]data.LLDPNeighbours{ LLDP: map[string]data.LLDPNeighbours{
"b-interface": data.LLDPNeighbours{}, "b-interface": {},
}, },
}, },
} }

View File

@ -14,7 +14,7 @@ func TestFilter(t *testing.T) {
// filtered - do not run all // filtered - do not run all
nodes := &runtime.Nodes{ nodes := &runtime.Nodes{
List: map[string]*runtime.Node{ List: map[string]*runtime.Node{
"a": &runtime.Node{ "a": {
Nodeinfo: &data.NodeInfo{NodeID: "a"}, Nodeinfo: &data.NodeInfo{NodeID: "a"},
}, },
}, },
@ -28,7 +28,7 @@ func TestFilter(t *testing.T) {
// run to end // run to end
nodes = &runtime.Nodes{ nodes = &runtime.Nodes{
List: map[string]*runtime.Node{ List: map[string]*runtime.Node{
"a": &runtime.Node{ "a": {
Nodeinfo: &data.NodeInfo{NodeID: "a"}, Nodeinfo: &data.NodeInfo{NodeID: "a"},
}, },
}, },

View File

@ -50,28 +50,28 @@ func TestStart(t *testing.T) {
}) })
allOutput, err := Register(map[string]interface{}{ allOutput, err := Register(map[string]interface{}{
"a": []map[string]interface{}{ "a": []map[string]interface{}{
map[string]interface{}{ {
"enable": false, "enable": false,
"path": "a1", "path": "a1",
}, },
map[string]interface{}{ {
"path": "a2", "path": "a2",
}, },
map[string]interface{}{ {
"enable": true, "enable": true,
"path": "a3", "path": "a3",
}, },
}, },
"b": nil, "b": nil,
"c": []map[string]interface{}{ "c": []map[string]interface{}{
map[string]interface{}{ {
"path": "c1", "path": "c1",
"filter": map[string]interface{}{}, "filter": map[string]interface{}{},
}, },
}, },
// fetch continue command in Connect // fetch continue command in Connect
"d": []map[string]interface{}{ "d": []map[string]interface{}{
map[string]interface{}{ {
"path": "d0", "path": "d0",
}, },
}, },
@ -84,7 +84,7 @@ func TestStart(t *testing.T) {
_, err = Register(map[string]interface{}{ _, err = Register(map[string]interface{}{
"e": []map[string]interface{}{ "e": []map[string]interface{}{
map[string]interface{}{}, {},
}, },
}) })
assert.Error(err) assert.Error(err)

View File

@ -19,7 +19,7 @@ func TestTransform(t *testing.T) {
Network: data.Network{ Network: data.Network{
Mac: "node:a:mac", Mac: "node:a:mac",
Mesh: map[string]*data.BatInterface{ Mesh: map[string]*data.BatInterface{
"bat0": &data.BatInterface{ "bat0": {
Interfaces: struct { Interfaces: struct {
Wireless []string `json:"wireless,omitempty"` Wireless []string `json:"wireless,omitempty"`
Other []string `json:"other,omitempty"` Other []string `json:"other,omitempty"`
@ -36,14 +36,14 @@ func TestTransform(t *testing.T) {
Neighbours: &data.Neighbours{ Neighbours: &data.Neighbours{
NodeID: "node_a", NodeID: "node_a",
Batadv: map[string]data.BatadvNeighbours{ Batadv: map[string]data.BatadvNeighbours{
"node:a:mac:wifi": data.BatadvNeighbours{ "node:a:mac:wifi": {
Neighbours: map[string]data.BatmanLink{ 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{ 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{ Network: data.Network{
Mac: "node:c:mac", Mac: "node:c:mac",
Mesh: map[string]*data.BatInterface{ Mesh: map[string]*data.BatInterface{
"bat0": &data.BatInterface{ "bat0": {
Interfaces: struct { Interfaces: struct {
Wireless []string `json:"wireless,omitempty"` Wireless []string `json:"wireless,omitempty"`
Other []string `json:"other,omitempty"` Other []string `json:"other,omitempty"`
@ -71,9 +71,9 @@ func TestTransform(t *testing.T) {
Neighbours: &data.Neighbours{ Neighbours: &data.Neighbours{
NodeID: "node_b", NodeID: "node_b",
Batadv: map[string]data.BatadvNeighbours{ Batadv: map[string]data.BatadvNeighbours{
"node:c:mac:lan": data.BatadvNeighbours{ "node:c:mac:lan": {
Neighbours: map[string]data.BatmanLink{ 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{ Network: data.Network{
Mac: "node:b:mac", Mac: "node:b:mac",
Mesh: map[string]*data.BatInterface{ Mesh: map[string]*data.BatInterface{
"bat0": &data.BatInterface{ "bat0": {
Interfaces: struct { Interfaces: struct {
Wireless []string `json:"wireless,omitempty"` Wireless []string `json:"wireless,omitempty"`
Other []string `json:"other,omitempty"` Other []string `json:"other,omitempty"`
@ -102,14 +102,14 @@ func TestTransform(t *testing.T) {
Neighbours: &data.Neighbours{ Neighbours: &data.Neighbours{
NodeID: "node_b", NodeID: "node_b",
Batadv: map[string]data.BatadvNeighbours{ Batadv: map[string]data.BatadvNeighbours{
"node:b:mac:lan": data.BatadvNeighbours{ "node:b:mac:lan": {
Neighbours: map[string]data.BatmanLink{ 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{ 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{ Network: data.Network{
Mac: "node:d:mac", Mac: "node:d:mac",
Mesh: map[string]*data.BatInterface{ Mesh: map[string]*data.BatInterface{
"bat0": &data.BatInterface{ "bat0": {
Interfaces: struct { Interfaces: struct {
Wireless []string `json:"wireless,omitempty"` Wireless []string `json:"wireless,omitempty"`
Other []string `json:"other,omitempty"` Other []string `json:"other,omitempty"`
@ -138,14 +138,14 @@ func TestTransform(t *testing.T) {
Neighbours: &data.Neighbours{ Neighbours: &data.Neighbours{
NodeID: "node_d", NodeID: "node_d",
Batadv: map[string]data.BatadvNeighbours{ Batadv: map[string]data.BatadvNeighbours{
"node:d:mac:lan": data.BatadvNeighbours{ "node:d:mac:lan": {
Neighbours: map[string]data.BatmanLink{ 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{ Neighbours: map[string]data.BatmanLink{
"node:a:mac:wifi": data.BatmanLink{Tq: 204}, "node:a:mac:wifi": {Tq: 204},
}, },
}, },
}, },

View File

@ -30,15 +30,15 @@ func TestRegister(t *testing.T) {
Total: 50, Total: 50,
}, },
Wireless: []*data.WirelessAirtime{ Wireless: []*data.WirelessAirtime{
&data.WirelessAirtime{ {
ChanUtil: 0.3, ChanUtil: 0.3,
Frequency: 2512, Frequency: 2512,
}, },
&data.WirelessAirtime{ {
ChanUtil: 0.4, ChanUtil: 0.4,
Frequency: 2612, Frequency: 2612,
}, },
&data.WirelessAirtime{ {
ChanUtil: 0.5, ChanUtil: 0.5,
Frequency: 5200, Frequency: 5200,
}, },

View File

@ -176,9 +176,9 @@ func TestLinksNodes(t *testing.T) {
Neighbours: &data.Neighbours{ Neighbours: &data.Neighbours{
NodeID: "f4f26dd7a30b", NodeID: "f4f26dd7a30b",
Batadv: map[string]data.BatadvNeighbours{ Batadv: map[string]data.BatadvNeighbours{
"f4:f2:6d:d7:a3:0b": data.BatadvNeighbours{ "f4:f2:6d:d7:a3:0b": {
Neighbours: map[string]data.BatmanLink{ Neighbours: map[string]data.BatmanLink{
"f4:f2:6d:d7:a3:0a": data.BatmanLink{ "f4:f2:6d:d7:a3:0a": {
Tq: 200, Lastseen: 0.42, Tq: 200, Lastseen: 0.42,
}, },
}, },

View File

@ -2,7 +2,7 @@ package runtime
const ( const (
DISABLED_AUTOUPDATER = "disabled" DISABLED_AUTOUPDATER = "disabled"
GLOBAL_SITE = "global" GLOBAL_SITE = "global"
) )
// CounterMap to manage multiple values // CounterMap to manage multiple values