gofmt
This commit is contained in:
parent
4014cbdb44
commit
35b1963eeb
@ -142,9 +142,9 @@ var infoCmd = &cli.Command{
|
||||
},
|
||||
}
|
||||
|
||||
type stateMeta struct{
|
||||
i int
|
||||
col color.Attribute
|
||||
type stateMeta struct {
|
||||
i int
|
||||
col color.Attribute
|
||||
state sealing.SectorState
|
||||
}
|
||||
|
||||
@ -178,8 +178,8 @@ var stateList = []stateMeta{
|
||||
func init() {
|
||||
for i, state := range stateList {
|
||||
stateOrder[state.state] = stateMeta{
|
||||
i: i,
|
||||
col: state.col,
|
||||
i: i,
|
||||
col: state.col,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ var storageListCmd = &cli.Command{
|
||||
type fsInfo struct {
|
||||
stores.ID
|
||||
sectors []stores.Decl
|
||||
stat stores.FsStat
|
||||
stat stores.FsStat
|
||||
}
|
||||
|
||||
sorted := make([]fsInfo, 0, len(st))
|
||||
@ -187,7 +187,7 @@ var storageListCmd = &cli.Command{
|
||||
}
|
||||
ping := time.Now().Sub(pingStart)
|
||||
|
||||
usedPercent := (st.Capacity-st.Available)*100/st.Capacity
|
||||
usedPercent := (st.Capacity - st.Available) * 100 / st.Capacity
|
||||
|
||||
percCol := color.FgGreen
|
||||
switch {
|
||||
@ -198,7 +198,7 @@ var storageListCmd = &cli.Command{
|
||||
}
|
||||
|
||||
var barCols = uint64(50)
|
||||
set := (st.Capacity-st.Available)*barCols/st.Capacity
|
||||
set := (st.Capacity - st.Available) * barCols / st.Capacity
|
||||
bar := strings.Repeat("|", int(set)) + strings.Repeat(" ", int(barCols-set))
|
||||
|
||||
fmt.Printf("\t[%s] %s/%s %s\n", color.New(percCol).Sprint(bar),
|
||||
|
@ -66,37 +66,36 @@ var workersListCmd = &cli.Command{
|
||||
gpuUse = ""
|
||||
}
|
||||
|
||||
|
||||
fmt.Printf("Worker %d, host %s\n", stat.id, color.MagentaString(stat.Info.Hostname))
|
||||
|
||||
var barCols = uint64(64)
|
||||
cpuBars := int(stat.CpuUse * barCols / stat.Info.Resources.CPUs)
|
||||
cpuBar := strings.Repeat("|", cpuBars) + strings.Repeat(" ", int(barCols) - cpuBars)
|
||||
cpuBar := strings.Repeat("|", cpuBars) + strings.Repeat(" ", int(barCols)-cpuBars)
|
||||
|
||||
fmt.Printf("\tCPU: [%s] %d core(s) in use\n", color.GreenString(cpuBar), stat.CpuUse)
|
||||
|
||||
ramBarsRes := int(stat.Info.Resources.MemReserved*barCols/stat.Info.Resources.MemPhysical)
|
||||
ramBarsUsed := int(stat.MemUsedMin*barCols/stat.Info.Resources.MemPhysical)
|
||||
ramBarsRes := int(stat.Info.Resources.MemReserved * barCols / stat.Info.Resources.MemPhysical)
|
||||
ramBarsUsed := int(stat.MemUsedMin * barCols / stat.Info.Resources.MemPhysical)
|
||||
ramBar := color.YellowString(strings.Repeat("|", ramBarsRes)) +
|
||||
color.GreenString(strings.Repeat("|", ramBarsUsed)) +
|
||||
strings.Repeat(" ", int(barCols) - ramBarsUsed - ramBarsRes)
|
||||
strings.Repeat(" ", int(barCols)-ramBarsUsed-ramBarsRes)
|
||||
|
||||
vmem := stat.Info.Resources.MemPhysical+stat.Info.Resources.MemSwap
|
||||
vmem := stat.Info.Resources.MemPhysical + stat.Info.Resources.MemSwap
|
||||
|
||||
vmemBarsRes := int(stat.Info.Resources.MemReserved*barCols/vmem)
|
||||
vmemBarsUsed := int(stat.MemUsedMax*barCols/vmem)
|
||||
vmemBarsRes := int(stat.Info.Resources.MemReserved * barCols / vmem)
|
||||
vmemBarsUsed := int(stat.MemUsedMax * barCols / vmem)
|
||||
vmemBar := color.YellowString(strings.Repeat("|", vmemBarsRes)) +
|
||||
color.GreenString(strings.Repeat("|", vmemBarsUsed)) +
|
||||
strings.Repeat(" ", int(barCols) - vmemBarsUsed - vmemBarsRes)
|
||||
strings.Repeat(" ", int(barCols)-vmemBarsUsed-vmemBarsRes)
|
||||
|
||||
fmt.Printf("\tRAM: [%s] %d%% %s/%s\n", ramBar,
|
||||
(stat.Info.Resources.MemReserved + stat.MemUsedMin)*100/stat.Info.Resources.MemPhysical,
|
||||
types.SizeStr(types.NewInt(stat.Info.Resources.MemReserved + stat.MemUsedMin)),
|
||||
(stat.Info.Resources.MemReserved+stat.MemUsedMin)*100/stat.Info.Resources.MemPhysical,
|
||||
types.SizeStr(types.NewInt(stat.Info.Resources.MemReserved+stat.MemUsedMin)),
|
||||
types.SizeStr(types.NewInt(stat.Info.Resources.MemPhysical)))
|
||||
|
||||
fmt.Printf("\tVMEM: [%s] %d%% %s/%s\n", vmemBar,
|
||||
(stat.Info.Resources.MemReserved + stat.MemUsedMax)*100/vmem,
|
||||
types.SizeStr(types.NewInt(stat.Info.Resources.MemReserved + stat.MemUsedMax)),
|
||||
(stat.Info.Resources.MemReserved+stat.MemUsedMax)*100/vmem,
|
||||
types.SizeStr(types.NewInt(stat.Info.Resources.MemReserved+stat.MemUsedMax)),
|
||||
types.SizeStr(types.NewInt(vmem)))
|
||||
|
||||
for _, gpu := range stat.Info.Resources.GPUs {
|
||||
|
@ -275,7 +275,7 @@ func TestUnmarshalableResult(t *testing.T) {
|
||||
}
|
||||
|
||||
type ChanHandler struct {
|
||||
wait chan struct{}
|
||||
wait chan struct{}
|
||||
ctxdone <-chan struct{}
|
||||
}
|
||||
|
||||
@ -436,7 +436,6 @@ func TestChanServerClose(t *testing.T) {
|
||||
require.Equal(t, false, ok)
|
||||
}
|
||||
|
||||
|
||||
func TestServerChanLockClose(t *testing.T) {
|
||||
var client struct {
|
||||
Sub func(context.Context, int, int) (<-chan int, error)
|
||||
|
Loading…
Reference in New Issue
Block a user