@@ -57,23 +57,23 @@ type WorkspaceGroup struct {
5757
5858// InstanceType represents an instance type from the API
5959type InstanceType struct {
60- Type string `json:"type"`
61- SupportedGPUs []GPU `json:"supported_gpus"`
62- SupportedStorage []Storage `json:"supported_storage"`
63- SupportedArchitectures []string `json:"supported_architectures"`
64- Memory string `json:"memory"`
65- InstanceMemoryBytes MemoryBytes `json:"memory_bytes"`
66- VCPU int `json:"vcpu"`
67- BasePrice BasePrice `json:"base_price"`
68- Location string `json:"location"`
69- SubLocation string `json:"sub_location"`
70- AvailableLocations []string `json:"available_locations"`
71- Provider string `json:"provider"`
72- WorkspaceGroups []WorkspaceGroup `json:"workspace_groups"`
73- EstimatedDeployTime string `json:"estimated_deploy_time"`
74- Stoppable bool `json:"stoppable"`
75- Rebootable bool `json:"rebootable"`
76- CanModifyFirewallRules bool `json:"can_modify_firewall_rules"`
60+ Type string `json:"type"`
61+ SupportedGPUs []GPU `json:"supported_gpus"`
62+ SupportedStorage []Storage `json:"supported_storage"`
63+ SupportedArchitectures []string `json:"supported_architectures"`
64+ Memory string `json:"memory"`
65+ InstanceMemoryBytes MemoryBytes `json:"memory_bytes"`
66+ VCPU int `json:"vcpu"`
67+ BasePrice BasePrice `json:"base_price"`
68+ Location string `json:"location"`
69+ SubLocation string `json:"sub_location"`
70+ AvailableLocations []string `json:"available_locations"`
71+ Provider string `json:"provider"`
72+ WorkspaceGroups []WorkspaceGroup `json:"workspace_groups"`
73+ EstimatedDeployTime string `json:"estimated_deploy_time"`
74+ Stoppable bool `json:"stoppable"`
75+ Rebootable bool `json:"rebootable"`
76+ CanModifyFirewallRules bool `json:"can_modify_firewall_rules"`
7777}
7878
7979// InstanceTypesResponse represents the API response
@@ -433,7 +433,7 @@ func DisplayCPUResults(t *terminal.Terminal, instances []GPUInstanceInfo, jsonOu
433433 displayCPUTablePlain (instances )
434434 return nil
435435 }
436- displayCPUTable (t , instances )
436+ displayCPUTable (instances )
437437 t .Vprintf ("\n %s\n " , t .Green (fmt .Sprintf ("Found %d CPU instance types" , len (instances ))))
438438 return nil
439439}
@@ -921,6 +921,8 @@ func FilterCPUInstances(instances []GPUInstanceInfo, provider, arch string, minR
921921}
922922
923923// SortInstances sorts the instance list by the specified column
924+ //
925+ //nolint:gocyclo
924926func SortInstances (instances []GPUInstanceInfo , sortBy string , descending bool ) {
925927 sort .Slice (instances , func (i , j int ) bool {
926928 var less bool
@@ -948,14 +950,13 @@ func SortInstances(instances []GPUInstanceInfo, sortBy string, descending bool)
948950 case "arch" :
949951 less = instances [i ].Arch < instances [j ].Arch
950952 case "boot-time" :
951- // Instances with no boot time (0) should always appear last
952953 switch {
953954 case instances [i ].BootTime == 0 && instances [j ].BootTime == 0 :
954- return false // both unknown, equal
955+ return false
955956 case instances [i ].BootTime == 0 :
956- return false // i unknown goes after j
957+ return false
957958 case instances [j ].BootTime == 0 :
958- return true // j unknown goes after i
959+ return true
959960 }
960961 less = instances [i ].BootTime < instances [j ].BootTime
961962 default :
@@ -1233,7 +1234,7 @@ func displayGPUTablePlainWide(instances []GPUInstanceInfo) {
12331234}
12341235
12351236// displayCPUTable renders CPU instances as a colored table
1236- func displayCPUTable (t * terminal. Terminal , instances []GPUInstanceInfo ) {
1237+ func displayCPUTable (instances []GPUInstanceInfo ) {
12371238 ta := table .NewWriter ()
12381239 ta .SetOutputMirror (os .Stdout )
12391240 ta .Style ().Options = getBrevTableOptions ()
0 commit comments