Skip to content

Commit 09ba9fd

Browse files
Update tool versions and fix errors and warnings that originated from the update
Update tool versions Fix the errors and warnings originated from the update: -Correct type deviceInfo (->DeviceInfo) to make it public -Fix gpu_plugin.go and vpu_plugin_test.go where stylecheck errors occur -Fix deprecation warnings -Rename type 'PatcherManager' to 'Manager' to solve exported errors -Rename type 'SgxMutator' to 'Mutator' to solve exported errors Signed-off-by: Hyeongju Johannes Lee <hyeongju.lee@intel.com>
1 parent 48d4ec4 commit 09ba9fd

File tree

13 files changed

+35
-38
lines changed

13 files changed

+35
-38
lines changed

.github/workflows/ci.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ on:
99
- main
1010
- 'release-*'
1111
env:
12-
RUNC_VERSION: v1.0.0
13-
GO_VERSION: 1.16.5
12+
RUNC_VERSION: v1.0.2
13+
GO_VERSION: 1.16.7
1414
jobs:
1515

1616
golangci:
@@ -25,7 +25,7 @@ jobs:
2525
- name: golangci-lint
2626
uses: golangci/golangci-lint-action@v2
2727
with:
28-
version: v1.36
28+
version: v1.42.0
2929
args: --timeout 5m
3030

3131
build:

.golangci.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,19 @@ linters:
1818
- godot
1919
- gofmt
2020
- goimports
21-
- golint
2221
- gomodguard
2322
- gosimple
2423
- gosec
2524
- govet
2625
- goprintffuncname
2726
- ineffassign
28-
- interfacer
29-
- maligned
3027
- misspell
3128
- nakedret
3229
- noctx
3330
- nolintlint
3431
- prealloc
32+
- revive
3533
- rowserrcheck
36-
- scopelint
3734
- staticcheck
3835
- structcheck
3936
- stylecheck

Jenkinsfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ pipeline {
88
environment {
99
GO111MODULE="on"
1010
REG="cloud-native-image-registry.westus.cloudapp.azure.com/"
11-
RUNC_VERSION="v1.0.0"
11+
RUNC_VERSION="v1.0.2"
1212
CRIO_VERSION="v1.20.0"
13-
GOLANGCI_LINT_VERSION="v1.36.0"
14-
GO_VERSION="1.16.5"
13+
GOLANGCI_LINT_VERSION="v1.42.0"
14+
GO_VERSION="1.16.7"
1515
GO_TAR="go${GO_VERSION}.linux-amd64.tar.gz"
1616
GOROOT="/usr/local/go"
1717
GOPATH="/tmp/go"

cmd/gpu_plugin/gpu_plugin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func newDevicePlugin(sysfsDir, devfsDir string, options cliOptions) *devicePlugi
9898

9999
func (dp *devicePlugin) Scan(notifier dpapi.Notifier) error {
100100
defer dp.scanTicker.Stop()
101-
var previouslyFound int = -1
101+
var previouslyFound = -1
102102

103103
for {
104104
devTree, err := dp.scan()

cmd/gpu_plugin/rm/gpu_plugin_resource_manager.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ type podCandidate struct {
6565
allocationTargetNum int
6666
}
6767

68-
type deviceInfo struct {
68+
type DeviceInfo struct {
6969
nodes []pluginapi.DeviceSpec
7070
mounts []pluginapi.Mount
7171
envs map[string]string
@@ -88,15 +88,15 @@ type resourceManager struct {
8888
prGetClientFunc getClientFunc
8989
}
9090

91-
func NewDeviceInfo(nodes []pluginapi.DeviceSpec, mounts []pluginapi.Mount, envs map[string]string) *deviceInfo {
92-
return &deviceInfo{
91+
func NewDeviceInfo(nodes []pluginapi.DeviceSpec, mounts []pluginapi.Mount, envs map[string]string) *DeviceInfo {
92+
return &DeviceInfo{
9393
nodes: nodes,
9494
mounts: mounts,
9595
envs: envs,
9696
}
9797
}
9898

99-
type DeviceInfoMap map[string]*deviceInfo
99+
type DeviceInfoMap map[string]*DeviceInfo
100100

101101
func NewDeviceInfoMap() DeviceInfoMap {
102102
return DeviceInfoMap{}

cmd/operator/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func main() {
9393
var metricsAddr string
9494
var devicePluginNamespace string
9595
var enableLeaderElection bool
96-
var pm *patcher.PatcherManager
96+
var pm *patcher.Manager
9797

9898
ctrl.SetLogger(klogr.New())
9999

@@ -146,7 +146,7 @@ func main() {
146146

147147
if contains(devices, "sgx") {
148148
mgr.GetWebhookServer().Register("/pods-sgx", &webhook.Admission{
149-
Handler: &sgxwebhook.SgxMutator{Client: mgr.GetClient()},
149+
Handler: &sgxwebhook.Mutator{Client: mgr.GetClient()},
150150
})
151151
}
152152

cmd/sgx_admissionwebhook/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func main() {
6060
}
6161

6262
mgr.GetWebhookServer().Register("/pods-sgx", &webhook.Admission{
63-
Handler: &sgxwebhook.SgxMutator{Client: mgr.GetClient()},
63+
Handler: &sgxwebhook.Mutator{Client: mgr.GetClient()},
6464
})
6565

6666
setupLog.Info("starting manager")

cmd/vpu_plugin/vpu_plugin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func getPciDeviceCounts(sysfsPciDevicesPath string, vendorID string, pidSearch [
9090
// Loop for list of pid of supported device type
9191
for _, pidVPU := range pciPid.pids {
9292
if vid == vendorID && pid == pidVPU {
93-
found[i] += 1
93+
found[i]++
9494
}
9595
}
9696
}

cmd/vpu_plugin/vpu_plugin_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ func createDevice(pciBusRootDir string, bdf string, vid string, pid string) erro
7272
}
7373

7474
func createTestPCI(folder string, testPCI []PCIPidDeviceType) error {
75-
var busNum int = 1
76-
var devNum int = 3
75+
var busNum = 1
76+
var devNum = 3
7777
//Loop for all supported device type
7878
for _, pciPid := range testPCI {
7979
//Loop for pid number
@@ -83,7 +83,7 @@ func createTestPCI(folder string, testPCI []PCIPidDeviceType) error {
8383
if err := createDevice(folder, strconv.Itoa(busNum), vendorIDIntel, pidVPU); err != nil {
8484
return err
8585
}
86-
busNum += 1
86+
busNum++
8787
}
8888
}
8989
}

pkg/fpgacontroller/fpgacontroller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import (
3636
type AcceleratorFunctionReconciler struct {
3737
client.Client
3838
Scheme *runtime.Scheme
39-
PatcherManager *patcher.PatcherManager
39+
PatcherManager *patcher.Manager
4040
}
4141

4242
// Reconcile reconciles updates for AcceleratorFunction objects.
@@ -71,7 +71,7 @@ func (r *AcceleratorFunctionReconciler) SetupWithManager(mgr ctrl.Manager) error
7171
type FpgaRegionReconciler struct {
7272
client.Client
7373
Scheme *runtime.Scheme
74-
PatcherManager *patcher.PatcherManager
74+
PatcherManager *patcher.Manager
7575
}
7676

7777
// Reconcile reconciles updates for FpgaRegion objects.

0 commit comments

Comments
 (0)