mirror of
https://github.com/shirou/gopsutil.git
synced 2025-05-12 19:29:30 +08:00
gofmt -s -w .
This commit is contained in:
parent
d0e40ff723
commit
23a4ae3369
@ -256,17 +256,17 @@ var kindUNIX = netConnectionKindType{
|
|||||||
}
|
}
|
||||||
|
|
||||||
var netConnectionKindMap = map[string][]netConnectionKindType{
|
var netConnectionKindMap = map[string][]netConnectionKindType{
|
||||||
"all": []netConnectionKindType{kindTCP4, kindTCP6, kindUDP4, kindUDP6, kindUNIX},
|
"all": {kindTCP4, kindTCP6, kindUDP4, kindUDP6, kindUNIX},
|
||||||
"tcp": []netConnectionKindType{kindTCP4, kindTCP6},
|
"tcp": {kindTCP4, kindTCP6},
|
||||||
"tcp4": []netConnectionKindType{kindTCP4},
|
"tcp4": {kindTCP4},
|
||||||
"tcp6": []netConnectionKindType{kindTCP6},
|
"tcp6": {kindTCP6},
|
||||||
"udp": []netConnectionKindType{kindUDP4, kindUDP6},
|
"udp": {kindUDP4, kindUDP6},
|
||||||
"udp4": []netConnectionKindType{kindUDP4},
|
"udp4": {kindUDP4},
|
||||||
"udp6": []netConnectionKindType{kindUDP6},
|
"udp6": {kindUDP6},
|
||||||
"unix": []netConnectionKindType{kindUNIX},
|
"unix": {kindUNIX},
|
||||||
"inet": []netConnectionKindType{kindTCP4, kindTCP6, kindUDP4, kindUDP6},
|
"inet": {kindTCP4, kindTCP6, kindUDP4, kindUDP6},
|
||||||
"inet4": []netConnectionKindType{kindTCP4, kindUDP4},
|
"inet4": {kindTCP4, kindUDP4},
|
||||||
"inet6": []netConnectionKindType{kindTCP6, kindUDP6},
|
"inet6": {kindTCP6, kindUDP6},
|
||||||
}
|
}
|
||||||
|
|
||||||
type inodeMap struct {
|
type inodeMap struct {
|
||||||
@ -680,7 +680,7 @@ func processUnix(file string, kind netConnectionKindType, inodes map[string][]in
|
|||||||
pairs, exists := inodes[inode]
|
pairs, exists := inodes[inode]
|
||||||
if !exists {
|
if !exists {
|
||||||
pairs = []inodeMap{
|
pairs = []inodeMap{
|
||||||
inodeMap{},
|
{},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, pair := range pairs {
|
for _, pair := range pairs {
|
||||||
|
@ -51,25 +51,25 @@ func TestDecodeAddress(t *testing.T) {
|
|||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
|
||||||
addr := map[string]AddrTest{
|
addr := map[string]AddrTest{
|
||||||
"0500000A:0016": AddrTest{
|
"0500000A:0016": {
|
||||||
IP: "10.0.0.5",
|
IP: "10.0.0.5",
|
||||||
Port: 22,
|
Port: 22,
|
||||||
},
|
},
|
||||||
"0100007F:D1C2": AddrTest{
|
"0100007F:D1C2": {
|
||||||
IP: "127.0.0.1",
|
IP: "127.0.0.1",
|
||||||
Port: 53698,
|
Port: 53698,
|
||||||
},
|
},
|
||||||
"11111:0035": AddrTest{
|
"11111:0035": {
|
||||||
Error: true,
|
Error: true,
|
||||||
},
|
},
|
||||||
"0100007F:BLAH": AddrTest{
|
"0100007F:BLAH": {
|
||||||
Error: true,
|
Error: true,
|
||||||
},
|
},
|
||||||
"0085002452100113070057A13F025401:0035": AddrTest{
|
"0085002452100113070057A13F025401:0035": {
|
||||||
IP: "2400:8500:1301:1052:a157:7:154:23f",
|
IP: "2400:8500:1301:1052:a157:7:154:23f",
|
||||||
Port: 53,
|
Port: 53,
|
||||||
},
|
},
|
||||||
"00855210011307F025401:0035": AddrTest{
|
"00855210011307F025401:0035": {
|
||||||
Error: true,
|
Error: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -97,12 +97,12 @@ func TestNetIOCountersPerNic(t *testing.T) {
|
|||||||
|
|
||||||
func TestGetNetIOCountersAll(t *testing.T) {
|
func TestGetNetIOCountersAll(t *testing.T) {
|
||||||
n := []IOCountersStat{
|
n := []IOCountersStat{
|
||||||
IOCountersStat{
|
{
|
||||||
Name: "a",
|
Name: "a",
|
||||||
BytesRecv: 10,
|
BytesRecv: 10,
|
||||||
PacketsRecv: 10,
|
PacketsRecv: 10,
|
||||||
},
|
},
|
||||||
IOCountersStat{
|
{
|
||||||
Name: "b",
|
Name: "b",
|
||||||
BytesRecv: 10,
|
BytesRecv: 10,
|
||||||
PacketsRecv: 10,
|
PacketsRecv: 10,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user