Skip to content

Commit

Permalink
fix code lint
Browse files Browse the repository at this point in the history
Signed-off-by: rongfu.leng <[email protected]>
  • Loading branch information
lengrongfu committed Mar 27, 2024
1 parent e529f78 commit dc54dc9
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 16 deletions.
8 changes: 4 additions & 4 deletions pkg/device/cambricon/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ const (
MluMemSplitEnable = "CAMBRICON_SPLIT_ENABLE"
MLUInUse = "cambricon.com/use-mlutype"
MLUNoUse = "cambricon.com/nouse-mlutype"
// MLUUseUUID is user can use specify MLU device for set MLU UUID
// MLUUseUUID is user can use specify MLU device for set MLU UUID.
MLUUseUUID = "cambricon.com/use-gpuuuid"
// MLUNoUseUUID is user can not use specify MLU device for set MLU UUID
// MLUNoUseUUID is user can not use specify MLU device for set MLU UUID.
MLUNoUseUUID = "cambricon.com/nouse-gpuuuid"
)

Expand Down Expand Up @@ -145,7 +145,7 @@ func (dev *CambriconDevices) CheckUUID(annos map[string]string, d util.DeviceUsa
// use , symbol to connect multiple uuid
userUUIDs := strings.Split(userUUID, ",")
for _, uuid := range userUUIDs {
if strings.Compare(d.ID, uuid) == 0 {
if d.ID == uuid {
return true
}
}
Expand All @@ -158,7 +158,7 @@ func (dev *CambriconDevices) CheckUUID(annos map[string]string, d util.DeviceUsa
// use , symbol to connect multiple uuid
noUserUUIDs := strings.Split(noUserUUID, ",")
for _, uuid := range noUserUUIDs {
if strings.Compare(d.ID, uuid) == 0 {
if d.ID == uuid {
return false
}
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/device/hygon/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ const (
HygonDCUCommonWord = "DCU"
DCUInUse = "hygon.com/use-dcutype"
DCUNoUse = "hygon.com/nouse-dcutype"
// DCUUseUUID is user can use specify DCU device for set DCU UUID
// DCUUseUUID is user can use specify DCU device for set DCU UUID.
DCUUseUUID = "hygon.com/use-gpuuuid"
// DCUNoUseUUID is user can not use specify DCU device for set DCU UUID
// DCUNoUseUUID is user can not use specify DCU device for set DCU UUID.
DCUNoUseUUID = "hygon.com/nouse-gpuuuid"
)

Expand Down Expand Up @@ -122,7 +122,7 @@ func (dev *DCUDevices) CheckUUID(annos map[string]string, d util.DeviceUsage) bo
// use , symbol to connect multiple uuid
userUUIDs := strings.Split(userUUID, ",")
for _, uuid := range userUUIDs {
if strings.Compare(d.ID, uuid) == 0 {
if d.ID == uuid {
return true
}
}
Expand All @@ -135,7 +135,7 @@ func (dev *DCUDevices) CheckUUID(annos map[string]string, d util.DeviceUsage) bo
// use , symbol to connect multiple uuid
noUserUUIDs := strings.Split(noUserUUID, ",")
for _, uuid := range noUserUUIDs {
if strings.Compare(d.ID, uuid) == 0 {
if d.ID == uuid {
return false
}
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/device/iluvatar/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ const (
IluvatarGPUDevice = "Iluvatar"
IluvatarGPUCommonWord = "Iluvatar"
IluvatarDeviceSelection = "iluvatar.ai/predicate-gpu-idx-"
// IluvatarUseUUID is user can use specify Iluvatar device for set Iluvatar UUID
// IluvatarUseUUID is user can use specify Iluvatar device for set Iluvatar UUID.
IluvatarUseUUID = "iluvatar.ai/use-gpuuuid"
// IluvatarNoUseUUID is user can not use specify Iluvatar device for set Iluvatar UUID
// IluvatarNoUseUUID is user can not use specify Iluvatar device for set Iluvatar UUID.
IluvatarNoUseUUID = "iluvatar.ai/nouse-gpuuuid"
)

Expand Down Expand Up @@ -112,7 +112,7 @@ func (dev *IluvatarDevices) CheckUUID(annos map[string]string, d util.DeviceUsag
// use , symbol to connect multiple uuid
userUUIDs := strings.Split(userUUID, ",")
for _, uuid := range userUUIDs {
if strings.Compare(d.ID, uuid) == 0 {
if d.ID == uuid {
return true
}
}
Expand All @@ -125,7 +125,7 @@ func (dev *IluvatarDevices) CheckUUID(annos map[string]string, d util.DeviceUsag
// use , symbol to connect multiple uuid
noUserUUIDs := strings.Split(noUserUUID, ",")
for _, uuid := range noUserUUIDs {
if strings.Compare(d.ID, uuid) == 0 {
if d.ID == uuid {
return false
}
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/device/nvidia/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ const (
GPUInUse = "nvidia.com/use-gputype"
GPUNoUse = "nvidia.com/nouse-gputype"
NumaBind = "nvidia.com/numa-bind"
// GPUUseUUID is user can use specify GPU device for set GPU UUID
// GPUUseUUID is user can use specify GPU device for set GPU UUID.
GPUUseUUID = "nvidia.com/use-gpuuuid"
// GPUNoUseUUID is user can not use specify GPU device for set GPU UUID
// GPUNoUseUUID is user can not use specify GPU device for set GPU UUID.
GPUNoUseUUID = "nvidia.com/nouse-gpuuuid"
)

Expand Down Expand Up @@ -172,7 +172,7 @@ func (dev *NvidiaGPUDevices) CheckUUID(annos map[string]string, d util.DeviceUsa
// use , symbol to connect multiple uuid
userUUIDs := strings.Split(userUUID, ",")
for _, uuid := range userUUIDs {
if strings.Compare(d.ID, uuid) == 0 {
if d.ID == uuid {
return true
}
}
Expand All @@ -185,7 +185,7 @@ func (dev *NvidiaGPUDevices) CheckUUID(annos map[string]string, d util.DeviceUsa
// use , symbol to connect multiple uuid
noUserUUIDs := strings.Split(noUserUUID, ",")
for _, uuid := range noUserUUIDs {
if strings.Compare(d.ID, uuid) == 0 {
if d.ID == uuid {
return false
}
}
Expand Down
1 change: 1 addition & 0 deletions pkg/device/nvidia/device_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"testing"

"github.com/Project-HAMi/HAMi/pkg/util"

"gotest.tools/v3/assert"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
Expand Down

0 comments on commit dc54dc9

Please sign in to comment.