From c6941be1736fadd4f684eb04e84f5e10bc83af9a Mon Sep 17 00:00:00 2001 From: Trey Dockendorf Date: Mon, 26 Apr 2021 14:23:37 -0400 Subject: [PATCH] Run gofmt -s --- collectors/hca_test.go | 8 ++++---- collectors/ibnetdiscover_test.go | 28 ++++++++++++++-------------- collectors/perfquery_test.go | 6 +++--- collectors/switch_test.go | 12 ++++++------ 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/collectors/hca_test.go b/collectors/hca_test.go index 1f98a46..2f8b15f 100644 --- a/collectors/hca_test.go +++ b/collectors/hca_test.go @@ -24,14 +24,14 @@ import ( var ( hcaDevices = []InfinibandDevice{ - InfinibandDevice{Type: "CA", LID: "133", GUID: "0x7cfe9003003b4b96", Rate: (25 * 4 * 125000000), Name: "o0002", + {Type: "CA", LID: "133", GUID: "0x7cfe9003003b4b96", Rate: (25 * 4 * 125000000), Name: "o0002", Uplinks: map[string]InfinibandUplink{ - "1": InfinibandUplink{Type: "SW", LID: "1719", PortNumber: "11", GUID: "0x7cfe9003009ce5b0", Name: "ib-i1l1s01"}, + "1": {Type: "SW", LID: "1719", PortNumber: "11", GUID: "0x7cfe9003009ce5b0", Name: "ib-i1l1s01"}, }, }, - InfinibandDevice{Type: "CA", LID: "134", GUID: "0x7cfe9003003b4bde", Rate: (25 * 4 * 125000000), Name: "o0001", + {Type: "CA", LID: "134", GUID: "0x7cfe9003003b4bde", Rate: (25 * 4 * 125000000), Name: "o0001", Uplinks: map[string]InfinibandUplink{ - "1": InfinibandUplink{Type: "SW", LID: "1719", PortNumber: "10", GUID: "0x7cfe9003009ce5b0", Name: "ib-i1l1s01"}, + "1": {Type: "SW", LID: "1719", PortNumber: "10", GUID: "0x7cfe9003009ce5b0", Name: "ib-i1l1s01"}, }, }, } diff --git a/collectors/ibnetdiscover_test.go b/collectors/ibnetdiscover_test.go index 979836f..ac76cf9 100644 --- a/collectors/ibnetdiscover_test.go +++ b/collectors/ibnetdiscover_test.go @@ -109,34 +109,34 @@ func TestIbnetdiscoverCollectorTimeout(t *testing.T) { func TestIbnetdiscoverParse(t *testing.T) { expectedHCAs := []InfinibandDevice{ - InfinibandDevice{Type: "CA", LID: "1432", GUID: "0x506b4b0300cc02a6", Rate: (25 * 4 * 125000000), Name: "p0001", + {Type: "CA", LID: "1432", GUID: "0x506b4b0300cc02a6", Rate: (25 * 4 * 125000000), Name: "p0001", Uplinks: map[string]InfinibandUplink{ - "1": InfinibandUplink{Type: "SW", LID: "2052", PortNumber: "35", GUID: "0x506b4b03005c2740", Name: "ib-i4l1s01"}, + "1": {Type: "SW", LID: "2052", PortNumber: "35", GUID: "0x506b4b03005c2740", Name: "ib-i4l1s01"}, }, }, - InfinibandDevice{Type: "CA", LID: "133", GUID: "0x7cfe9003003b4b96", Rate: (25 * 4 * 125000000), Name: "o0002", + {Type: "CA", LID: "133", GUID: "0x7cfe9003003b4b96", Rate: (25 * 4 * 125000000), Name: "o0002", Uplinks: map[string]InfinibandUplink{ - "1": InfinibandUplink{Type: "SW", LID: "1719", PortNumber: "11", GUID: "0x7cfe9003009ce5b0", Name: "ib-i1l1s01"}, + "1": {Type: "SW", LID: "1719", PortNumber: "11", GUID: "0x7cfe9003009ce5b0", Name: "ib-i1l1s01"}, }, }, - InfinibandDevice{Type: "CA", LID: "134", GUID: "0x7cfe9003003b4bde", Rate: (25 * 4 * 125000000), Name: "o0001", + {Type: "CA", LID: "134", GUID: "0x7cfe9003003b4bde", Rate: (25 * 4 * 125000000), Name: "o0001", Uplinks: map[string]InfinibandUplink{ - "1": InfinibandUplink{Type: "SW", LID: "1719", PortNumber: "10", GUID: "0x7cfe9003009ce5b0", Name: "ib-i1l1s01"}, + "1": {Type: "SW", LID: "1719", PortNumber: "10", GUID: "0x7cfe9003009ce5b0", Name: "ib-i1l1s01"}, }, }, } expectSwitches := []InfinibandDevice{ - InfinibandDevice{Type: "SW", LID: "2052", GUID: "0x506b4b03005c2740", Rate: (25 * 4 * 125000000), Name: "ib-i4l1s01", + {Type: "SW", LID: "2052", GUID: "0x506b4b03005c2740", Rate: (25 * 4 * 125000000), Name: "ib-i4l1s01", Uplinks: map[string]InfinibandUplink{ - "35": InfinibandUplink{Type: "CA", LID: "1432", PortNumber: "1", GUID: "0x506b4b0300cc02a6", Name: "p0001"}, + "35": {Type: "CA", LID: "1432", PortNumber: "1", GUID: "0x506b4b0300cc02a6", Name: "p0001"}, }, }, - InfinibandDevice{Type: "SW", LID: "1719", GUID: "0x7cfe9003009ce5b0", Rate: (25 * 4 * 125000000), Name: "ib-i1l1s01", + {Type: "SW", LID: "1719", GUID: "0x7cfe9003009ce5b0", Rate: (25 * 4 * 125000000), Name: "ib-i1l1s01", Uplinks: map[string]InfinibandUplink{ - "1": InfinibandUplink{Type: "SW", LID: "1516", PortNumber: "1", GUID: "0x7cfe900300b07320", Name: "ib-i1l2s01"}, - "10": InfinibandUplink{Type: "CA", LID: "134", PortNumber: "1", GUID: "0x7cfe9003003b4bde", Name: "o0001"}, - "11": InfinibandUplink{Type: "CA", LID: "133", PortNumber: "1", GUID: "0x7cfe9003003b4b96", Name: "o0002"}, + "1": {Type: "SW", LID: "1516", PortNumber: "1", GUID: "0x7cfe900300b07320", Name: "ib-i1l2s01"}, + "10": {Type: "CA", LID: "134", PortNumber: "1", GUID: "0x7cfe9003003b4bde", Name: "o0001"}, + "11": {Type: "CA", LID: "133", PortNumber: "1", GUID: "0x7cfe9003003b4b96", Name: "o0002"}, }, }, } @@ -293,8 +293,8 @@ func TestParseNamesErrors(t *testing.T) { func TestGetDevicePorts(t *testing.T) { uplinks := map[string]InfinibandUplink{ - "10": InfinibandUplink{Type: "CA", LID: "134", PortNumber: "1", GUID: "0x7cfe9003003b4bde", Name: "o0001"}, - "11": InfinibandUplink{Type: "CA", LID: "133", PortNumber: "1", GUID: "0x7cfe9003003b4b96", Name: "o0002"}, + "10": {Type: "CA", LID: "134", PortNumber: "1", GUID: "0x7cfe9003003b4bde", Name: "o0001"}, + "11": {Type: "CA", LID: "133", PortNumber: "1", GUID: "0x7cfe9003003b4b96", Name: "o0002"}, } expected := []string{"10", "11"} ports := getDevicePorts(uplinks) diff --git a/collectors/perfquery_test.go b/collectors/perfquery_test.go index 8c314c6..05c6969 100644 --- a/collectors/perfquery_test.go +++ b/collectors/perfquery_test.go @@ -40,7 +40,7 @@ PortRcvPkts:.....................32262508468` func TestPerfqueryParse(t *testing.T) { expected := []PerfQueryCounters{ - PerfQueryCounters{ + { device: perfqueryTestDevice, PortSelect: "1", PortXmitData: 36298026860928, @@ -72,7 +72,7 @@ func TestPerfqueryParse(t *testing.T) { PortVLMappingErrors: math.NaN(), PortLoopingErrors: math.NaN(), }, - PerfQueryCounters{ + { device: perfqueryTestDevice, PortSelect: "2", PortXmitData: 26006570014026, @@ -121,7 +121,7 @@ func TestPerfqueryParse(t *testing.T) { func TestPerfqueryParseRcvErrorDetails(t *testing.T) { expected := []PerfQueryCounters{ - PerfQueryCounters{ + { device: perfqueryTestDevice, PortSelect: "1", PortXmitData: math.NaN(), diff --git a/collectors/switch_test.go b/collectors/switch_test.go index c87224e..2fbe7c8 100644 --- a/collectors/switch_test.go +++ b/collectors/switch_test.go @@ -24,16 +24,16 @@ import ( var ( switchDevices = []InfinibandDevice{ - InfinibandDevice{Type: "SW", LID: "2052", GUID: "0x506b4b03005c2740", Rate: (25 * 4 * 125000000), Name: "ib-i4l1s01", + {Type: "SW", LID: "2052", GUID: "0x506b4b03005c2740", Rate: (25 * 4 * 125000000), Name: "ib-i4l1s01", Uplinks: map[string]InfinibandUplink{ - "35": InfinibandUplink{Type: "CA", LID: "1432", PortNumber: "1", GUID: "0x506b4b0300cc02a6", Name: "p0001"}, + "35": {Type: "CA", LID: "1432", PortNumber: "1", GUID: "0x506b4b0300cc02a6", Name: "p0001"}, }, }, - InfinibandDevice{Type: "SW", LID: "1719", GUID: "0x7cfe9003009ce5b0", Rate: (25 * 4 * 125000000), Name: "ib-i1l1s01", + {Type: "SW", LID: "1719", GUID: "0x7cfe9003009ce5b0", Rate: (25 * 4 * 125000000), Name: "ib-i1l1s01", Uplinks: map[string]InfinibandUplink{ - "1": InfinibandUplink{Type: "SW", LID: "1516", PortNumber: "1", GUID: "0x7cfe900300b07320", Name: "ib-i1l2s01"}, - "10": InfinibandUplink{Type: "CA", LID: "134", PortNumber: "1", GUID: "0x7cfe9003003b4bde", Name: "o0001"}, - "11": InfinibandUplink{Type: "CA", LID: "133", PortNumber: "1", GUID: "0x7cfe9003003b4b96", Name: "o0002"}, + "1": {Type: "SW", LID: "1516", PortNumber: "1", GUID: "0x7cfe900300b07320", Name: "ib-i1l2s01"}, + "10": {Type: "CA", LID: "134", PortNumber: "1", GUID: "0x7cfe9003003b4bde", Name: "o0001"}, + "11": {Type: "CA", LID: "133", PortNumber: "1", GUID: "0x7cfe9003003b4b96", Name: "o0002"}, }, }, }