From 7627d48a5c29cb6713de189c8c46abad596e5b82 Mon Sep 17 00:00:00 2001 From: Tariq Ibrahim Date: Thu, 30 Nov 2023 17:10:10 -0800 Subject: [PATCH] run goimports -local against the entire codebase Signed-off-by: Tariq Ibrahim Signed-off-by: Evan Lezar --- .golangci.yml | 4 ++++ Makefile | 5 +++++ cmd/nvidia-container-runtime-hook/container_config.go | 3 ++- .../container_config_test.go | 3 ++- cmd/nvidia-container-runtime-hook/hook_config_test.go | 3 ++- cmd/nvidia-container-runtime/main_test.go | 5 +++-- cmd/nvidia-ctk/cdi/cdi.go | 3 ++- cmd/nvidia-ctk/cdi/generate/generate.go | 5 +++-- cmd/nvidia-ctk/cdi/list/list.go | 3 ++- cmd/nvidia-ctk/cdi/transform/root/root.go | 5 +++-- cmd/nvidia-ctk/cdi/transform/transform.go | 3 ++- cmd/nvidia-ctk/config/config.go | 3 ++- cmd/nvidia-ctk/config/create-default/create-default.go | 3 ++- cmd/nvidia-ctk/hook/chmod/chmod.go | 3 ++- cmd/nvidia-ctk/hook/create-symlinks/create-symlinks.go | 3 ++- cmd/nvidia-ctk/hook/hook.go | 3 ++- cmd/nvidia-ctk/hook/update-ldcache/update-ldcache.go | 3 ++- cmd/nvidia-ctk/info/info.go | 3 ++- cmd/nvidia-ctk/main.go | 3 ++- cmd/nvidia-ctk/runtime/runtime.go | 3 ++- cmd/nvidia-ctk/system/create-dev-char-symlinks/all.go | 1 + .../create-dev-char-symlinks/create-dev-char-symlinks.go | 5 +++-- .../system/create-dev-char-symlinks/existing.go | 3 ++- .../system/create-device-nodes/create-device-nodes.go | 3 ++- cmd/nvidia-ctk/system/print-ldcache/print-ldcache.go | 3 ++- cmd/nvidia-ctk/system/system.go | 3 ++- internal/config/config.go | 3 ++- internal/discover/char_devices_test.go | 3 ++- internal/discover/icp_test.go | 3 ++- internal/discover/mounts_test.go | 3 ++- internal/edits/device.go | 3 ++- internal/edits/device_test.go | 3 ++- internal/edits/edits.go | 7 ++++--- internal/edits/edits_test.go | 3 ++- internal/edits/hook.go | 3 ++- internal/edits/mount.go | 3 ++- internal/info/auto.go | 1 + internal/info/auto_test.go | 3 ++- internal/lookup/cuda/cuda_test.go | 3 ++- internal/lookup/library_test.go | 3 ++- internal/modifier/cdi/builder.go | 5 +++-- internal/modifier/cdi/registry.go | 5 +++-- internal/modifier/cdi/spec.go | 3 ++- internal/modifier/csv_test.go | 5 +++-- internal/modifier/discover.go | 3 ++- internal/modifier/discover_test.go | 3 ++- internal/modifier/graphics_test.go | 3 ++- internal/modifier/hook_remover.go | 3 ++- internal/modifier/list.go | 3 ++- internal/modifier/stable.go | 3 ++- internal/modifier/stable_test.go | 3 ++- internal/oci/spec.go | 3 ++- internal/oci/spec_mock.go | 3 ++- internal/oci/spec_test.go | 3 ++- internal/platform-support/tegra/csv/csv_test.go | 3 ++- internal/platform-support/tegra/csv_test.go | 5 +++-- internal/runtime/logger.go | 3 ++- internal/runtime/runtime.go | 3 ++- internal/runtime/runtime_factory_test.go | 5 +++-- internal/system/nvdevices/devices_test.go | 3 ++- internal/system/nvdevices/mknod.go | 3 ++- pkg/config/engine/containerd/config_v1.go | 3 ++- pkg/config/engine/containerd/config_v2.go | 3 ++- pkg/config/engine/containerd/containerd.go | 3 ++- pkg/config/engine/containerd/option.go | 3 ++- pkg/config/engine/crio/crio.go | 3 ++- pkg/config/engine/crio/option.go | 3 ++- pkg/nvcdi/api.go | 3 ++- pkg/nvcdi/driver-nvml.go | 3 ++- pkg/nvcdi/driver-wsl_test.go | 3 ++- pkg/nvcdi/full-gpu-nvml.go | 5 +++-- pkg/nvcdi/gds.go | 5 +++-- pkg/nvcdi/lib-csv.go | 5 +++-- pkg/nvcdi/lib-nvml.go | 5 +++-- pkg/nvcdi/lib-wsl.go | 5 +++-- pkg/nvcdi/lib.go | 1 + pkg/nvcdi/management.go | 5 +++-- pkg/nvcdi/mig-device-nvml.go | 5 +++-- pkg/nvcdi/mofed.go | 5 +++-- pkg/nvcdi/namer_nvml_mock.go | 3 ++- pkg/nvcdi/options.go | 1 + pkg/nvcdi/spec/builder.go | 3 ++- pkg/nvcdi/transform/noop/no-op.go | 3 ++- pkg/nvcdi/transform/root/container-root.go | 3 ++- pkg/nvcdi/transform/root/host-root.go | 3 ++- tools/container/container.go | 5 +++-- tools/container/containerd/config_v1_test.go | 5 +++-- tools/container/containerd/config_v2_test.go | 5 +++-- tools/container/containerd/containerd.go | 5 +++-- tools/container/crio/crio.go | 5 +++-- tools/container/docker/docker.go | 5 +++-- tools/container/docker/docker_test.go | 3 ++- tools/container/toolkit/toolkit.go | 9 +++++---- 93 files changed, 215 insertions(+), 115 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index cd7efc23..ea51b6d9 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -15,6 +15,10 @@ linters: - staticcheck - unconvert +linters-settings: + goimports: + local-prefixes: github.com/NVIDIA/nvidia-container-toolkit + issues: exclude-rules: # Exclude the gocritic dupSubExpr issue for cgo files. diff --git a/Makefile b/Makefile index a9247f81..3afbd9c6 100644 --- a/Makefile +++ b/Makefile @@ -78,6 +78,11 @@ fmt: go list -f '{{.Dir}}' $(MODULE)/... \ | xargs gofmt -s -l -w +# Apply goimports -local github.com/NVIDIA/container-toolkit to the codebase +goimports: + go list -f {{.Dir}} $(MODULE)/... \ + | xargs goimports -local $(MODULE) -w + golangci-lint: golangci-lint run ./... diff --git a/cmd/nvidia-container-runtime-hook/container_config.go b/cmd/nvidia-container-runtime-hook/container_config.go index f3562247..cdd1471f 100644 --- a/cmd/nvidia-container-runtime-hook/container_config.go +++ b/cmd/nvidia-container-runtime-hook/container_config.go @@ -9,9 +9,10 @@ import ( "path/filepath" "strings" - "github.com/NVIDIA/nvidia-container-toolkit/internal/config/image" "github.com/opencontainers/runtime-spec/specs-go" "golang.org/x/mod/semver" + + "github.com/NVIDIA/nvidia-container-toolkit/internal/config/image" ) const ( diff --git a/cmd/nvidia-container-runtime-hook/container_config_test.go b/cmd/nvidia-container-runtime-hook/container_config_test.go index 2e2bd632..43fac8aa 100644 --- a/cmd/nvidia-container-runtime-hook/container_config_test.go +++ b/cmd/nvidia-container-runtime-hook/container_config_test.go @@ -5,8 +5,9 @@ import ( "path/filepath" "testing" - "github.com/NVIDIA/nvidia-container-toolkit/internal/config/image" "github.com/stretchr/testify/require" + + "github.com/NVIDIA/nvidia-container-toolkit/internal/config/image" ) func TestGetNvidiaConfig(t *testing.T) { diff --git a/cmd/nvidia-container-runtime-hook/hook_config_test.go b/cmd/nvidia-container-runtime-hook/hook_config_test.go index 4e71a4ab..7c50ec12 100644 --- a/cmd/nvidia-container-runtime-hook/hook_config_test.go +++ b/cmd/nvidia-container-runtime-hook/hook_config_test.go @@ -21,8 +21,9 @@ import ( "os" "testing" - "github.com/NVIDIA/nvidia-container-toolkit/internal/config/image" "github.com/stretchr/testify/require" + + "github.com/NVIDIA/nvidia-container-toolkit/internal/config/image" ) func TestGetHookConfig(t *testing.T) { diff --git a/cmd/nvidia-container-runtime/main_test.go b/cmd/nvidia-container-runtime/main_test.go index 90bfbea7..ff3926fb 100644 --- a/cmd/nvidia-container-runtime/main_test.go +++ b/cmd/nvidia-container-runtime/main_test.go @@ -11,11 +11,12 @@ import ( "strings" "testing" - "github.com/NVIDIA/nvidia-container-toolkit/internal/modifier" - "github.com/NVIDIA/nvidia-container-toolkit/internal/test" "github.com/opencontainers/runtime-spec/specs-go" testlog "github.com/sirupsen/logrus/hooks/test" "github.com/stretchr/testify/require" + + "github.com/NVIDIA/nvidia-container-toolkit/internal/modifier" + "github.com/NVIDIA/nvidia-container-toolkit/internal/test" ) const ( diff --git a/cmd/nvidia-ctk/cdi/cdi.go b/cmd/nvidia-ctk/cdi/cdi.go index 0c394b70..1020488a 100644 --- a/cmd/nvidia-ctk/cdi/cdi.go +++ b/cmd/nvidia-ctk/cdi/cdi.go @@ -17,11 +17,12 @@ package cdi import ( + "github.com/urfave/cli/v2" + "github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-ctk/cdi/generate" "github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-ctk/cdi/list" "github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-ctk/cdi/transform" "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" - "github.com/urfave/cli/v2" ) type command struct { diff --git a/cmd/nvidia-ctk/cdi/generate/generate.go b/cmd/nvidia-ctk/cdi/generate/generate.go index 124fbc0f..4a7ae18d 100644 --- a/cmd/nvidia-ctk/cdi/generate/generate.go +++ b/cmd/nvidia-ctk/cdi/generate/generate.go @@ -22,14 +22,15 @@ import ( "path/filepath" "strings" + "github.com/urfave/cli/v2" + cdi "tags.cncf.io/container-device-interface/pkg/parser" + "github.com/NVIDIA/nvidia-container-toolkit/internal/config" "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" "github.com/NVIDIA/nvidia-container-toolkit/internal/platform-support/tegra/csv" "github.com/NVIDIA/nvidia-container-toolkit/pkg/nvcdi" "github.com/NVIDIA/nvidia-container-toolkit/pkg/nvcdi/spec" "github.com/NVIDIA/nvidia-container-toolkit/pkg/nvcdi/transform" - "github.com/urfave/cli/v2" - cdi "tags.cncf.io/container-device-interface/pkg/parser" ) const ( diff --git a/cmd/nvidia-ctk/cdi/list/list.go b/cmd/nvidia-ctk/cdi/list/list.go index bb6a6a28..1f9d39f8 100644 --- a/cmd/nvidia-ctk/cdi/list/list.go +++ b/cmd/nvidia-ctk/cdi/list/list.go @@ -19,9 +19,10 @@ package list import ( "fmt" - "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" "github.com/urfave/cli/v2" "tags.cncf.io/container-device-interface/pkg/cdi" + + "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" ) type command struct { diff --git a/cmd/nvidia-ctk/cdi/transform/root/root.go b/cmd/nvidia-ctk/cdi/transform/root/root.go index 4de8d9c6..61cb284a 100644 --- a/cmd/nvidia-ctk/cdi/transform/root/root.go +++ b/cmd/nvidia-ctk/cdi/transform/root/root.go @@ -21,11 +21,12 @@ import ( "io" "os" + "github.com/urfave/cli/v2" + "tags.cncf.io/container-device-interface/pkg/cdi" + "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" "github.com/NVIDIA/nvidia-container-toolkit/pkg/nvcdi/spec" transformroot "github.com/NVIDIA/nvidia-container-toolkit/pkg/nvcdi/transform/root" - "github.com/urfave/cli/v2" - "tags.cncf.io/container-device-interface/pkg/cdi" ) type command struct { diff --git a/cmd/nvidia-ctk/cdi/transform/transform.go b/cmd/nvidia-ctk/cdi/transform/transform.go index 98c17b85..9528a1fc 100644 --- a/cmd/nvidia-ctk/cdi/transform/transform.go +++ b/cmd/nvidia-ctk/cdi/transform/transform.go @@ -17,9 +17,10 @@ package transform import ( + "github.com/urfave/cli/v2" + "github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-ctk/cdi/transform/root" "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" - "github.com/urfave/cli/v2" ) type command struct { diff --git a/cmd/nvidia-ctk/config/config.go b/cmd/nvidia-ctk/config/config.go index 1cd1896e..3f10f727 100644 --- a/cmd/nvidia-ctk/config/config.go +++ b/cmd/nvidia-ctk/config/config.go @@ -23,11 +23,12 @@ import ( "strconv" "strings" + "github.com/urfave/cli/v2" + createdefault "github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-ctk/config/create-default" "github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-ctk/config/flags" "github.com/NVIDIA/nvidia-container-toolkit/internal/config" "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" - "github.com/urfave/cli/v2" ) type command struct { diff --git a/cmd/nvidia-ctk/config/create-default/create-default.go b/cmd/nvidia-ctk/config/create-default/create-default.go index e16eb855..929a9c3e 100644 --- a/cmd/nvidia-ctk/config/create-default/create-default.go +++ b/cmd/nvidia-ctk/config/create-default/create-default.go @@ -19,10 +19,11 @@ package defaultsubcommand import ( "fmt" + "github.com/urfave/cli/v2" + "github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-ctk/config/flags" "github.com/NVIDIA/nvidia-container-toolkit/internal/config" "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" - "github.com/urfave/cli/v2" ) type command struct { diff --git a/cmd/nvidia-ctk/hook/chmod/chmod.go b/cmd/nvidia-ctk/hook/chmod/chmod.go index 0caa37b9..9a4ee656 100644 --- a/cmd/nvidia-ctk/hook/chmod/chmod.go +++ b/cmd/nvidia-ctk/hook/chmod/chmod.go @@ -25,9 +25,10 @@ import ( "strconv" "strings" + "github.com/urfave/cli/v2" + "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" "github.com/NVIDIA/nvidia-container-toolkit/internal/oci" - "github.com/urfave/cli/v2" ) type command struct { diff --git a/cmd/nvidia-ctk/hook/create-symlinks/create-symlinks.go b/cmd/nvidia-ctk/hook/create-symlinks/create-symlinks.go index b57b4cd8..b59ce727 100644 --- a/cmd/nvidia-ctk/hook/create-symlinks/create-symlinks.go +++ b/cmd/nvidia-ctk/hook/create-symlinks/create-symlinks.go @@ -22,12 +22,13 @@ import ( "path/filepath" "strings" + "github.com/urfave/cli/v2" + "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" "github.com/NVIDIA/nvidia-container-toolkit/internal/lookup" "github.com/NVIDIA/nvidia-container-toolkit/internal/lookup/symlinks" "github.com/NVIDIA/nvidia-container-toolkit/internal/oci" "github.com/NVIDIA/nvidia-container-toolkit/internal/platform-support/tegra/csv" - "github.com/urfave/cli/v2" ) type command struct { diff --git a/cmd/nvidia-ctk/hook/hook.go b/cmd/nvidia-ctk/hook/hook.go index e796eafd..54088988 100644 --- a/cmd/nvidia-ctk/hook/hook.go +++ b/cmd/nvidia-ctk/hook/hook.go @@ -20,9 +20,10 @@ import ( chmod "github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-ctk/hook/chmod" "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" + "github.com/urfave/cli/v2" + symlinks "github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-ctk/hook/create-symlinks" ldcache "github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-ctk/hook/update-ldcache" - "github.com/urfave/cli/v2" ) type hookCommand struct { diff --git a/cmd/nvidia-ctk/hook/update-ldcache/update-ldcache.go b/cmd/nvidia-ctk/hook/update-ldcache/update-ldcache.go index 934b7b3f..10fd8398 100644 --- a/cmd/nvidia-ctk/hook/update-ldcache/update-ldcache.go +++ b/cmd/nvidia-ctk/hook/update-ldcache/update-ldcache.go @@ -23,10 +23,11 @@ import ( "strings" "syscall" + "github.com/urfave/cli/v2" + "github.com/NVIDIA/nvidia-container-toolkit/internal/config" "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" "github.com/NVIDIA/nvidia-container-toolkit/internal/oci" - "github.com/urfave/cli/v2" ) type command struct { diff --git a/cmd/nvidia-ctk/info/info.go b/cmd/nvidia-ctk/info/info.go index 6fccbd43..9e8ba8cd 100644 --- a/cmd/nvidia-ctk/info/info.go +++ b/cmd/nvidia-ctk/info/info.go @@ -17,8 +17,9 @@ package info import ( - "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" "github.com/urfave/cli/v2" + + "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" ) type command struct { diff --git a/cmd/nvidia-ctk/main.go b/cmd/nvidia-ctk/main.go index 8cbb56c2..9a12ae16 100644 --- a/cmd/nvidia-ctk/main.go +++ b/cmd/nvidia-ctk/main.go @@ -19,6 +19,8 @@ package main import ( "os" + "github.com/sirupsen/logrus" + "github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-ctk/cdi" "github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-ctk/config" "github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-ctk/hook" @@ -26,7 +28,6 @@ import ( "github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-ctk/runtime" "github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-ctk/system" "github.com/NVIDIA/nvidia-container-toolkit/internal/info" - "github.com/sirupsen/logrus" cli "github.com/urfave/cli/v2" ) diff --git a/cmd/nvidia-ctk/runtime/runtime.go b/cmd/nvidia-ctk/runtime/runtime.go index d2828e64..1e3e7a54 100644 --- a/cmd/nvidia-ctk/runtime/runtime.go +++ b/cmd/nvidia-ctk/runtime/runtime.go @@ -17,9 +17,10 @@ package runtime import ( + "github.com/urfave/cli/v2" + "github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-ctk/runtime/configure" "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" - "github.com/urfave/cli/v2" ) type runtimeCommand struct { diff --git a/cmd/nvidia-ctk/system/create-dev-char-symlinks/all.go b/cmd/nvidia-ctk/system/create-dev-char-symlinks/all.go index 2f9ef5df..cafb8f9c 100644 --- a/cmd/nvidia-ctk/system/create-dev-char-symlinks/all.go +++ b/cmd/nvidia-ctk/system/create-dev-char-symlinks/all.go @@ -21,6 +21,7 @@ import ( "path/filepath" "github.com/NVIDIA/go-nvlib/pkg/nvpci" + "github.com/NVIDIA/nvidia-container-toolkit/internal/info/proc/devices" "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" "github.com/NVIDIA/nvidia-container-toolkit/internal/nvcaps" diff --git a/cmd/nvidia-ctk/system/create-dev-char-symlinks/create-dev-char-symlinks.go b/cmd/nvidia-ctk/system/create-dev-char-symlinks/create-dev-char-symlinks.go index ed6455bd..ad5c4af1 100644 --- a/cmd/nvidia-ctk/system/create-dev-char-symlinks/create-dev-char-symlinks.go +++ b/cmd/nvidia-ctk/system/create-dev-char-symlinks/create-dev-char-symlinks.go @@ -24,11 +24,12 @@ import ( "strings" "syscall" + "github.com/fsnotify/fsnotify" + "github.com/urfave/cli/v2" + "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" "github.com/NVIDIA/nvidia-container-toolkit/internal/system/nvdevices" "github.com/NVIDIA/nvidia-container-toolkit/internal/system/nvmodules" - "github.com/fsnotify/fsnotify" - "github.com/urfave/cli/v2" ) const ( diff --git a/cmd/nvidia-ctk/system/create-dev-char-symlinks/existing.go b/cmd/nvidia-ctk/system/create-dev-char-symlinks/existing.go index 946f42b0..d022a98f 100644 --- a/cmd/nvidia-ctk/system/create-dev-char-symlinks/existing.go +++ b/cmd/nvidia-ctk/system/create-dev-char-symlinks/existing.go @@ -20,9 +20,10 @@ import ( "path/filepath" "strings" + "golang.org/x/sys/unix" + "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" "github.com/NVIDIA/nvidia-container-toolkit/internal/lookup" - "golang.org/x/sys/unix" ) type nodeLister interface { diff --git a/cmd/nvidia-ctk/system/create-device-nodes/create-device-nodes.go b/cmd/nvidia-ctk/system/create-device-nodes/create-device-nodes.go index 4ca31131..8e4cf515 100644 --- a/cmd/nvidia-ctk/system/create-device-nodes/create-device-nodes.go +++ b/cmd/nvidia-ctk/system/create-device-nodes/create-device-nodes.go @@ -19,10 +19,11 @@ package createdevicenodes import ( "fmt" + "github.com/urfave/cli/v2" + "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" "github.com/NVIDIA/nvidia-container-toolkit/internal/system/nvdevices" "github.com/NVIDIA/nvidia-container-toolkit/internal/system/nvmodules" - "github.com/urfave/cli/v2" ) type command struct { diff --git a/cmd/nvidia-ctk/system/print-ldcache/print-ldcache.go b/cmd/nvidia-ctk/system/print-ldcache/print-ldcache.go index b7547f48..b12184c4 100644 --- a/cmd/nvidia-ctk/system/print-ldcache/print-ldcache.go +++ b/cmd/nvidia-ctk/system/print-ldcache/print-ldcache.go @@ -19,9 +19,10 @@ package createdevicenodes import ( "fmt" + "github.com/urfave/cli/v2" + "github.com/NVIDIA/nvidia-container-toolkit/internal/ldcache" "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" - "github.com/urfave/cli/v2" ) type command struct { diff --git a/cmd/nvidia-ctk/system/system.go b/cmd/nvidia-ctk/system/system.go index cbb328da..fc6b6922 100644 --- a/cmd/nvidia-ctk/system/system.go +++ b/cmd/nvidia-ctk/system/system.go @@ -17,11 +17,12 @@ package system import ( + "github.com/urfave/cli/v2" + devchar "github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-ctk/system/create-dev-char-symlinks" devicenodes "github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-ctk/system/create-device-nodes" ldcache "github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-ctk/system/print-ldcache" "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" - "github.com/urfave/cli/v2" ) type command struct { diff --git a/internal/config/config.go b/internal/config/config.go index bda139df..07d8ae4c 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -22,10 +22,11 @@ import ( "path/filepath" "strings" + "tags.cncf.io/container-device-interface/pkg/cdi" + "github.com/NVIDIA/nvidia-container-toolkit/internal/config/image" "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" "github.com/NVIDIA/nvidia-container-toolkit/internal/lookup" - "tags.cncf.io/container-device-interface/pkg/cdi" ) const ( diff --git a/internal/discover/char_devices_test.go b/internal/discover/char_devices_test.go index af820bb4..022e3237 100644 --- a/internal/discover/char_devices_test.go +++ b/internal/discover/char_devices_test.go @@ -20,9 +20,10 @@ import ( "fmt" "testing" - "github.com/NVIDIA/nvidia-container-toolkit/internal/lookup" testlog "github.com/sirupsen/logrus/hooks/test" "github.com/stretchr/testify/require" + + "github.com/NVIDIA/nvidia-container-toolkit/internal/lookup" ) func TestCharDevices(t *testing.T) { diff --git a/internal/discover/icp_test.go b/internal/discover/icp_test.go index 6769886c..f214f522 100644 --- a/internal/discover/icp_test.go +++ b/internal/discover/icp_test.go @@ -19,9 +19,10 @@ package discover import ( "testing" - "github.com/NVIDIA/nvidia-container-toolkit/internal/lookup" testlog "github.com/sirupsen/logrus/hooks/test" "github.com/stretchr/testify/require" + + "github.com/NVIDIA/nvidia-container-toolkit/internal/lookup" ) func TestIPCMounts(t *testing.T) { diff --git a/internal/discover/mounts_test.go b/internal/discover/mounts_test.go index 14598cc6..c239db3a 100644 --- a/internal/discover/mounts_test.go +++ b/internal/discover/mounts_test.go @@ -20,9 +20,10 @@ import ( "fmt" "testing" - "github.com/NVIDIA/nvidia-container-toolkit/internal/lookup" "github.com/stretchr/testify/require" + "github.com/NVIDIA/nvidia-container-toolkit/internal/lookup" + testlog "github.com/sirupsen/logrus/hooks/test" ) diff --git a/internal/edits/device.go b/internal/edits/device.go index 2a5d71c2..d04df153 100644 --- a/internal/edits/device.go +++ b/internal/edits/device.go @@ -17,9 +17,10 @@ package edits import ( - "github.com/NVIDIA/nvidia-container-toolkit/internal/discover" "tags.cncf.io/container-device-interface/pkg/cdi" "tags.cncf.io/container-device-interface/specs-go" + + "github.com/NVIDIA/nvidia-container-toolkit/internal/discover" ) type device discover.Device diff --git a/internal/edits/device_test.go b/internal/edits/device_test.go index 97e4ed8a..45b4c526 100644 --- a/internal/edits/device_test.go +++ b/internal/edits/device_test.go @@ -20,9 +20,10 @@ import ( "fmt" "testing" - "github.com/NVIDIA/nvidia-container-toolkit/internal/discover" "github.com/stretchr/testify/require" "tags.cncf.io/container-device-interface/specs-go" + + "github.com/NVIDIA/nvidia-container-toolkit/internal/discover" ) func TestDeviceToSpec(t *testing.T) { diff --git a/internal/edits/edits.go b/internal/edits/edits.go index bc86f499..029e7885 100644 --- a/internal/edits/edits.go +++ b/internal/edits/edits.go @@ -19,12 +19,13 @@ package edits import ( "fmt" - "github.com/NVIDIA/nvidia-container-toolkit/internal/discover" - "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" - "github.com/NVIDIA/nvidia-container-toolkit/internal/oci" ociSpecs "github.com/opencontainers/runtime-spec/specs-go" "tags.cncf.io/container-device-interface/pkg/cdi" "tags.cncf.io/container-device-interface/specs-go" + + "github.com/NVIDIA/nvidia-container-toolkit/internal/discover" + "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" + "github.com/NVIDIA/nvidia-container-toolkit/internal/oci" ) type edits struct { diff --git a/internal/edits/edits_test.go b/internal/edits/edits_test.go index 65211557..0c891860 100644 --- a/internal/edits/edits_test.go +++ b/internal/edits/edits_test.go @@ -19,8 +19,9 @@ package edits import ( "testing" - "github.com/NVIDIA/nvidia-container-toolkit/internal/discover" "github.com/stretchr/testify/require" + + "github.com/NVIDIA/nvidia-container-toolkit/internal/discover" ) func TestFromDiscovererAllowsMountsToIterate(t *testing.T) { diff --git a/internal/edits/hook.go b/internal/edits/hook.go index ec894f86..f528fe1d 100644 --- a/internal/edits/hook.go +++ b/internal/edits/hook.go @@ -17,9 +17,10 @@ package edits import ( - "github.com/NVIDIA/nvidia-container-toolkit/internal/discover" "tags.cncf.io/container-device-interface/pkg/cdi" "tags.cncf.io/container-device-interface/specs-go" + + "github.com/NVIDIA/nvidia-container-toolkit/internal/discover" ) type hook discover.Hook diff --git a/internal/edits/mount.go b/internal/edits/mount.go index 53b9f45d..a588ec04 100644 --- a/internal/edits/mount.go +++ b/internal/edits/mount.go @@ -17,9 +17,10 @@ package edits import ( - "github.com/NVIDIA/nvidia-container-toolkit/internal/discover" "tags.cncf.io/container-device-interface/pkg/cdi" "tags.cncf.io/container-device-interface/specs-go" + + "github.com/NVIDIA/nvidia-container-toolkit/internal/discover" ) type mount discover.Mount diff --git a/internal/info/auto.go b/internal/info/auto.go index f72021e9..4b2745d9 100644 --- a/internal/info/auto.go +++ b/internal/info/auto.go @@ -20,6 +20,7 @@ import ( "github.com/NVIDIA/go-nvlib/pkg/nvlib/device" "github.com/NVIDIA/go-nvlib/pkg/nvlib/info" "github.com/NVIDIA/go-nvlib/pkg/nvml" + "github.com/NVIDIA/nvidia-container-toolkit/internal/config/image" "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" ) diff --git a/internal/info/auto_test.go b/internal/info/auto_test.go index fb845d78..e986ced7 100644 --- a/internal/info/auto_test.go +++ b/internal/info/auto_test.go @@ -19,10 +19,11 @@ package info import ( "testing" - "github.com/NVIDIA/nvidia-container-toolkit/internal/config/image" "github.com/opencontainers/runtime-spec/specs-go" testlog "github.com/sirupsen/logrus/hooks/test" "github.com/stretchr/testify/require" + + "github.com/NVIDIA/nvidia-container-toolkit/internal/config/image" ) func TestResolveAutoMode(t *testing.T) { diff --git a/internal/lookup/cuda/cuda_test.go b/internal/lookup/cuda/cuda_test.go index 5db69c25..652ecc5b 100644 --- a/internal/lookup/cuda/cuda_test.go +++ b/internal/lookup/cuda/cuda_test.go @@ -23,9 +23,10 @@ import ( "strings" "testing" - "github.com/NVIDIA/nvidia-container-toolkit/internal/lookup" testlog "github.com/sirupsen/logrus/hooks/test" "github.com/stretchr/testify/require" + + "github.com/NVIDIA/nvidia-container-toolkit/internal/lookup" ) func TestLocate(t *testing.T) { diff --git a/internal/lookup/library_test.go b/internal/lookup/library_test.go index 60dba77c..dd686b75 100644 --- a/internal/lookup/library_test.go +++ b/internal/lookup/library_test.go @@ -22,9 +22,10 @@ import ( "strings" "testing" - "github.com/NVIDIA/nvidia-container-toolkit/internal/ldcache" testlog "github.com/sirupsen/logrus/hooks/test" "github.com/stretchr/testify/require" + + "github.com/NVIDIA/nvidia-container-toolkit/internal/ldcache" ) func TestLDCacheLocator(t *testing.T) { diff --git a/internal/modifier/cdi/builder.go b/internal/modifier/cdi/builder.go index 7cae8bcc..9d49488d 100644 --- a/internal/modifier/cdi/builder.go +++ b/internal/modifier/cdi/builder.go @@ -19,10 +19,11 @@ package cdi import ( "fmt" - "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" - "github.com/NVIDIA/nvidia-container-toolkit/internal/oci" "tags.cncf.io/container-device-interface/pkg/cdi" "tags.cncf.io/container-device-interface/specs-go" + + "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" + "github.com/NVIDIA/nvidia-container-toolkit/internal/oci" ) type builder struct { diff --git a/internal/modifier/cdi/registry.go b/internal/modifier/cdi/registry.go index 7ed12856..d1faffad 100644 --- a/internal/modifier/cdi/registry.go +++ b/internal/modifier/cdi/registry.go @@ -20,10 +20,11 @@ import ( "errors" "fmt" - "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" - "github.com/NVIDIA/nvidia-container-toolkit/internal/oci" "github.com/opencontainers/runtime-spec/specs-go" "tags.cncf.io/container-device-interface/pkg/cdi" + + "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" + "github.com/NVIDIA/nvidia-container-toolkit/internal/oci" ) // fromRegistry represents the modifications performed using a CDI registry. diff --git a/internal/modifier/cdi/spec.go b/internal/modifier/cdi/spec.go index e33c7aa1..24b475ee 100644 --- a/internal/modifier/cdi/spec.go +++ b/internal/modifier/cdi/spec.go @@ -19,9 +19,10 @@ package cdi import ( "fmt" - "github.com/NVIDIA/nvidia-container-toolkit/internal/oci" "github.com/opencontainers/runtime-spec/specs-go" "tags.cncf.io/container-device-interface/pkg/cdi" + + "github.com/NVIDIA/nvidia-container-toolkit/internal/oci" ) // fromCDISpec represents the modifications performed from a raw CDI spec. diff --git a/internal/modifier/csv_test.go b/internal/modifier/csv_test.go index 32fd097c..8e5f60b0 100644 --- a/internal/modifier/csv_test.go +++ b/internal/modifier/csv_test.go @@ -19,11 +19,12 @@ package modifier import ( "testing" - "github.com/NVIDIA/nvidia-container-toolkit/internal/config" - "github.com/NVIDIA/nvidia-container-toolkit/internal/config/image" "github.com/opencontainers/runtime-spec/specs-go" testlog "github.com/sirupsen/logrus/hooks/test" "github.com/stretchr/testify/require" + + "github.com/NVIDIA/nvidia-container-toolkit/internal/config" + "github.com/NVIDIA/nvidia-container-toolkit/internal/config/image" ) func TestNewCSVModifier(t *testing.T) { diff --git a/internal/modifier/discover.go b/internal/modifier/discover.go index 2dfa1129..b249c559 100644 --- a/internal/modifier/discover.go +++ b/internal/modifier/discover.go @@ -19,11 +19,12 @@ package modifier import ( "fmt" + "github.com/opencontainers/runtime-spec/specs-go" + "github.com/NVIDIA/nvidia-container-toolkit/internal/discover" "github.com/NVIDIA/nvidia-container-toolkit/internal/edits" "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" "github.com/NVIDIA/nvidia-container-toolkit/internal/oci" - "github.com/opencontainers/runtime-spec/specs-go" ) type discoverModifier struct { diff --git a/internal/modifier/discover_test.go b/internal/modifier/discover_test.go index bbad61aa..77c3ef17 100644 --- a/internal/modifier/discover_test.go +++ b/internal/modifier/discover_test.go @@ -20,10 +20,11 @@ import ( "fmt" "testing" - "github.com/NVIDIA/nvidia-container-toolkit/internal/discover" "github.com/opencontainers/runtime-spec/specs-go" testlog "github.com/sirupsen/logrus/hooks/test" "github.com/stretchr/testify/require" + + "github.com/NVIDIA/nvidia-container-toolkit/internal/discover" ) func TestDiscoverModifier(t *testing.T) { diff --git a/internal/modifier/graphics_test.go b/internal/modifier/graphics_test.go index 163f3628..186af48a 100644 --- a/internal/modifier/graphics_test.go +++ b/internal/modifier/graphics_test.go @@ -19,8 +19,9 @@ package modifier import ( "testing" - "github.com/NVIDIA/nvidia-container-toolkit/internal/config/image" "github.com/stretchr/testify/require" + + "github.com/NVIDIA/nvidia-container-toolkit/internal/config/image" ) func TestGraphicsModifier(t *testing.T) { diff --git a/internal/modifier/hook_remover.go b/internal/modifier/hook_remover.go index f9af14ba..059cd8af 100644 --- a/internal/modifier/hook_remover.go +++ b/internal/modifier/hook_remover.go @@ -19,10 +19,11 @@ package modifier import ( "path/filepath" + "github.com/opencontainers/runtime-spec/specs-go" + "github.com/NVIDIA/nvidia-container-toolkit/internal/config" "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" "github.com/NVIDIA/nvidia-container-toolkit/internal/oci" - "github.com/opencontainers/runtime-spec/specs-go" ) // nvidiaContainerRuntimeHookRemover is a spec modifer that detects and removes inserted nvidia-container-runtime hooks diff --git a/internal/modifier/list.go b/internal/modifier/list.go index 16061219..b6d040e6 100644 --- a/internal/modifier/list.go +++ b/internal/modifier/list.go @@ -17,8 +17,9 @@ package modifier import ( - "github.com/NVIDIA/nvidia-container-toolkit/internal/oci" "github.com/opencontainers/runtime-spec/specs-go" + + "github.com/NVIDIA/nvidia-container-toolkit/internal/oci" ) type list struct { diff --git a/internal/modifier/stable.go b/internal/modifier/stable.go index c72a94c3..3a842bff 100644 --- a/internal/modifier/stable.go +++ b/internal/modifier/stable.go @@ -19,9 +19,10 @@ package modifier import ( "path/filepath" + "github.com/opencontainers/runtime-spec/specs-go" + "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" "github.com/NVIDIA/nvidia-container-toolkit/internal/oci" - "github.com/opencontainers/runtime-spec/specs-go" ) // NewStableRuntimeModifier creates an OCI spec modifier that inserts the NVIDIA Container Runtime Hook into an OCI diff --git a/internal/modifier/stable_test.go b/internal/modifier/stable_test.go index 586bdbb2..994f08c1 100644 --- a/internal/modifier/stable_test.go +++ b/internal/modifier/stable_test.go @@ -22,10 +22,11 @@ import ( "path/filepath" "testing" - "github.com/NVIDIA/nvidia-container-toolkit/internal/test" "github.com/opencontainers/runtime-spec/specs-go" testlog "github.com/sirupsen/logrus/hooks/test" "github.com/stretchr/testify/require" + + "github.com/NVIDIA/nvidia-container-toolkit/internal/test" ) type testConfig struct { diff --git a/internal/oci/spec.go b/internal/oci/spec.go index f433e1c4..2daa7503 100644 --- a/internal/oci/spec.go +++ b/internal/oci/spec.go @@ -19,8 +19,9 @@ package oci import ( "fmt" - "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" "github.com/opencontainers/runtime-spec/specs-go" + + "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" ) // SpecModifier defines an interface for modifying a (raw) OCI spec diff --git a/internal/oci/spec_mock.go b/internal/oci/spec_mock.go index ff8ff647..f004d69c 100644 --- a/internal/oci/spec_mock.go +++ b/internal/oci/spec_mock.go @@ -4,8 +4,9 @@ package oci import ( - "github.com/opencontainers/runtime-spec/specs-go" "sync" + + "github.com/opencontainers/runtime-spec/specs-go" ) // Ensure, that SpecMock does implement Spec. diff --git a/internal/oci/spec_test.go b/internal/oci/spec_test.go index 1acf1728..c626c5bf 100644 --- a/internal/oci/spec_test.go +++ b/internal/oci/spec_test.go @@ -5,8 +5,9 @@ import ( "path/filepath" "testing" - "github.com/NVIDIA/nvidia-container-toolkit/internal/test" "github.com/stretchr/testify/require" + + "github.com/NVIDIA/nvidia-container-toolkit/internal/test" ) func TestMaintainSpec(t *testing.T) { diff --git a/internal/platform-support/tegra/csv/csv_test.go b/internal/platform-support/tegra/csv/csv_test.go index 919f4add..03d98219 100644 --- a/internal/platform-support/tegra/csv/csv_test.go +++ b/internal/platform-support/tegra/csv/csv_test.go @@ -20,8 +20,9 @@ import ( "path/filepath" "testing" - "github.com/NVIDIA/nvidia-container-toolkit/internal/test" "github.com/stretchr/testify/require" + + "github.com/NVIDIA/nvidia-container-toolkit/internal/test" ) func TestGetFileList(t *testing.T) { diff --git a/internal/platform-support/tegra/csv_test.go b/internal/platform-support/tegra/csv_test.go index a40acf3c..69ea1e53 100644 --- a/internal/platform-support/tegra/csv_test.go +++ b/internal/platform-support/tegra/csv_test.go @@ -20,11 +20,12 @@ import ( "fmt" "testing" + testlog "github.com/sirupsen/logrus/hooks/test" + "github.com/stretchr/testify/require" + "github.com/NVIDIA/nvidia-container-toolkit/internal/discover" "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" "github.com/NVIDIA/nvidia-container-toolkit/internal/lookup" - testlog "github.com/sirupsen/logrus/hooks/test" - "github.com/stretchr/testify/require" "github.com/NVIDIA/nvidia-container-toolkit/internal/platform-support/tegra/csv" ) diff --git a/internal/runtime/logger.go b/internal/runtime/logger.go index a23702a4..1b950026 100644 --- a/internal/runtime/logger.go +++ b/internal/runtime/logger.go @@ -26,8 +26,9 @@ import ( "strconv" "strings" - "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" "github.com/sirupsen/logrus" + + "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" ) // Logger adds a way to manage output to a log file to a logrus.Logger diff --git a/internal/runtime/runtime.go b/internal/runtime/runtime.go index 87a11f6a..c98f9658 100644 --- a/internal/runtime/runtime.go +++ b/internal/runtime/runtime.go @@ -22,9 +22,10 @@ import ( "fmt" "strings" + "github.com/opencontainers/runtime-spec/specs-go" + "github.com/NVIDIA/nvidia-container-toolkit/internal/config" "github.com/NVIDIA/nvidia-container-toolkit/internal/info" - "github.com/opencontainers/runtime-spec/specs-go" ) // Run is an entry point that allows for idiomatic handling of errors diff --git a/internal/runtime/runtime_factory_test.go b/internal/runtime/runtime_factory_test.go index 2b783aa0..33056fa3 100644 --- a/internal/runtime/runtime_factory_test.go +++ b/internal/runtime/runtime_factory_test.go @@ -24,11 +24,12 @@ import ( "path/filepath" "testing" - "github.com/NVIDIA/nvidia-container-toolkit/internal/config" - "github.com/NVIDIA/nvidia-container-toolkit/internal/test" "github.com/opencontainers/runtime-spec/specs-go" testlog "github.com/sirupsen/logrus/hooks/test" "github.com/stretchr/testify/require" + + "github.com/NVIDIA/nvidia-container-toolkit/internal/config" + "github.com/NVIDIA/nvidia-container-toolkit/internal/test" ) const ( diff --git a/internal/system/nvdevices/devices_test.go b/internal/system/nvdevices/devices_test.go index 5d94bc75..388f91dc 100644 --- a/internal/system/nvdevices/devices_test.go +++ b/internal/system/nvdevices/devices_test.go @@ -20,9 +20,10 @@ import ( "errors" "testing" - "github.com/NVIDIA/nvidia-container-toolkit/internal/info/proc/devices" testlog "github.com/sirupsen/logrus/hooks/test" "github.com/stretchr/testify/require" + + "github.com/NVIDIA/nvidia-container-toolkit/internal/info/proc/devices" ) func TestCreateControlDevices(t *testing.T) { diff --git a/internal/system/nvdevices/mknod.go b/internal/system/nvdevices/mknod.go index e5990ea0..88a7aa44 100644 --- a/internal/system/nvdevices/mknod.go +++ b/internal/system/nvdevices/mknod.go @@ -17,8 +17,9 @@ package nvdevices import ( - "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" "golang.org/x/sys/unix" + + "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" ) //go:generate moq -stub -out mknod_mock.go . mknoder diff --git a/pkg/config/engine/containerd/config_v1.go b/pkg/config/engine/containerd/config_v1.go index d058d21c..04a11cd3 100644 --- a/pkg/config/engine/containerd/config_v1.go +++ b/pkg/config/engine/containerd/config_v1.go @@ -19,8 +19,9 @@ package containerd import ( "fmt" - "github.com/NVIDIA/nvidia-container-toolkit/pkg/config/engine" "github.com/pelletier/go-toml" + + "github.com/NVIDIA/nvidia-container-toolkit/pkg/config/engine" ) // ConfigV1 represents a version 1 containerd config diff --git a/pkg/config/engine/containerd/config_v2.go b/pkg/config/engine/containerd/config_v2.go index 6d3b2d80..18dc6b18 100644 --- a/pkg/config/engine/containerd/config_v2.go +++ b/pkg/config/engine/containerd/config_v2.go @@ -19,8 +19,9 @@ package containerd import ( "fmt" - "github.com/NVIDIA/nvidia-container-toolkit/pkg/config/engine" "github.com/pelletier/go-toml" + + "github.com/NVIDIA/nvidia-container-toolkit/pkg/config/engine" ) // AddRuntime adds a runtime to the containerd config diff --git a/pkg/config/engine/containerd/containerd.go b/pkg/config/engine/containerd/containerd.go index 17ba9a0c..b2ea62fa 100644 --- a/pkg/config/engine/containerd/containerd.go +++ b/pkg/config/engine/containerd/containerd.go @@ -17,9 +17,10 @@ package containerd import ( + "github.com/pelletier/go-toml" + "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" "github.com/NVIDIA/nvidia-container-toolkit/pkg/config/engine" - "github.com/pelletier/go-toml" ) // Config represents the containerd config diff --git a/pkg/config/engine/containerd/option.go b/pkg/config/engine/containerd/option.go index 23eeb484..5a3ba0e1 100644 --- a/pkg/config/engine/containerd/option.go +++ b/pkg/config/engine/containerd/option.go @@ -20,9 +20,10 @@ import ( "fmt" "os" + "github.com/pelletier/go-toml" + "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" "github.com/NVIDIA/nvidia-container-toolkit/pkg/config/engine" - "github.com/pelletier/go-toml" ) const ( diff --git a/pkg/config/engine/crio/crio.go b/pkg/config/engine/crio/crio.go index 6832d3a1..0cc4a251 100644 --- a/pkg/config/engine/crio/crio.go +++ b/pkg/config/engine/crio/crio.go @@ -19,8 +19,9 @@ package crio import ( "fmt" - "github.com/NVIDIA/nvidia-container-toolkit/pkg/config/engine" "github.com/pelletier/go-toml" + + "github.com/NVIDIA/nvidia-container-toolkit/pkg/config/engine" ) // Config represents the cri-o config diff --git a/pkg/config/engine/crio/option.go b/pkg/config/engine/crio/option.go index 7ad90e4f..b457ffa8 100644 --- a/pkg/config/engine/crio/option.go +++ b/pkg/config/engine/crio/option.go @@ -20,8 +20,9 @@ import ( "fmt" "os" - "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" "github.com/pelletier/go-toml" + + "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" ) type builder struct { diff --git a/pkg/nvcdi/api.go b/pkg/nvcdi/api.go index 9d158d8d..43aad634 100644 --- a/pkg/nvcdi/api.go +++ b/pkg/nvcdi/api.go @@ -18,9 +18,10 @@ package nvcdi import ( "github.com/NVIDIA/go-nvlib/pkg/nvlib/device" - "github.com/NVIDIA/nvidia-container-toolkit/pkg/nvcdi/spec" "tags.cncf.io/container-device-interface/pkg/cdi" "tags.cncf.io/container-device-interface/specs-go" + + "github.com/NVIDIA/nvidia-container-toolkit/pkg/nvcdi/spec" ) const ( diff --git a/pkg/nvcdi/driver-nvml.go b/pkg/nvcdi/driver-nvml.go index 28bd0704..052e3241 100644 --- a/pkg/nvcdi/driver-nvml.go +++ b/pkg/nvcdi/driver-nvml.go @@ -23,12 +23,13 @@ import ( "strings" "github.com/NVIDIA/go-nvlib/pkg/nvml" + "golang.org/x/sys/unix" + "github.com/NVIDIA/nvidia-container-toolkit/internal/discover" "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" "github.com/NVIDIA/nvidia-container-toolkit/internal/lookup" "github.com/NVIDIA/nvidia-container-toolkit/internal/lookup/cuda" "github.com/NVIDIA/nvidia-container-toolkit/internal/lookup/root" - "golang.org/x/sys/unix" ) // NewDriverDiscoverer creates a discoverer for the libraries and binaries associated with a driver installation. diff --git a/pkg/nvcdi/driver-wsl_test.go b/pkg/nvcdi/driver-wsl_test.go index 39729130..b579d75f 100644 --- a/pkg/nvcdi/driver-wsl_test.go +++ b/pkg/nvcdi/driver-wsl_test.go @@ -20,9 +20,10 @@ import ( "errors" "testing" - "github.com/NVIDIA/nvidia-container-toolkit/internal/discover" "github.com/stretchr/testify/require" + "github.com/NVIDIA/nvidia-container-toolkit/internal/discover" + testlog "github.com/sirupsen/logrus/hooks/test" ) diff --git a/pkg/nvcdi/full-gpu-nvml.go b/pkg/nvcdi/full-gpu-nvml.go index d47c802d..6793cbbc 100644 --- a/pkg/nvcdi/full-gpu-nvml.go +++ b/pkg/nvcdi/full-gpu-nvml.go @@ -24,12 +24,13 @@ import ( "github.com/NVIDIA/go-nvlib/pkg/nvlib/device" "github.com/NVIDIA/go-nvlib/pkg/nvml" + "tags.cncf.io/container-device-interface/pkg/cdi" + "tags.cncf.io/container-device-interface/specs-go" + "github.com/NVIDIA/nvidia-container-toolkit/internal/discover" "github.com/NVIDIA/nvidia-container-toolkit/internal/edits" "github.com/NVIDIA/nvidia-container-toolkit/internal/info/drm" "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" - "tags.cncf.io/container-device-interface/pkg/cdi" - "tags.cncf.io/container-device-interface/specs-go" ) // GetGPUDeviceSpecs returns the CDI device specs for the full GPU represented by 'device'. diff --git a/pkg/nvcdi/gds.go b/pkg/nvcdi/gds.go index c50ab5e5..cb1bf760 100644 --- a/pkg/nvcdi/gds.go +++ b/pkg/nvcdi/gds.go @@ -20,11 +20,12 @@ import ( "fmt" "github.com/NVIDIA/go-nvlib/pkg/nvlib/device" + "tags.cncf.io/container-device-interface/pkg/cdi" + "tags.cncf.io/container-device-interface/specs-go" + "github.com/NVIDIA/nvidia-container-toolkit/internal/discover" "github.com/NVIDIA/nvidia-container-toolkit/internal/edits" "github.com/NVIDIA/nvidia-container-toolkit/pkg/nvcdi/spec" - "tags.cncf.io/container-device-interface/pkg/cdi" - "tags.cncf.io/container-device-interface/specs-go" ) type gdslib nvcdilib diff --git a/pkg/nvcdi/lib-csv.go b/pkg/nvcdi/lib-csv.go index 14b6b5a0..86d86f93 100644 --- a/pkg/nvcdi/lib-csv.go +++ b/pkg/nvcdi/lib-csv.go @@ -20,12 +20,13 @@ import ( "fmt" "github.com/NVIDIA/go-nvlib/pkg/nvlib/device" + "tags.cncf.io/container-device-interface/pkg/cdi" + "tags.cncf.io/container-device-interface/specs-go" + "github.com/NVIDIA/nvidia-container-toolkit/internal/discover" "github.com/NVIDIA/nvidia-container-toolkit/internal/edits" "github.com/NVIDIA/nvidia-container-toolkit/internal/platform-support/tegra" "github.com/NVIDIA/nvidia-container-toolkit/pkg/nvcdi/spec" - "tags.cncf.io/container-device-interface/pkg/cdi" - "tags.cncf.io/container-device-interface/specs-go" ) type csvlib nvcdilib diff --git a/pkg/nvcdi/lib-nvml.go b/pkg/nvcdi/lib-nvml.go index 82cc9b6e..3ce68ec9 100644 --- a/pkg/nvcdi/lib-nvml.go +++ b/pkg/nvcdi/lib-nvml.go @@ -21,10 +21,11 @@ import ( "github.com/NVIDIA/go-nvlib/pkg/nvlib/device" "github.com/NVIDIA/go-nvlib/pkg/nvml" - "github.com/NVIDIA/nvidia-container-toolkit/internal/edits" - "github.com/NVIDIA/nvidia-container-toolkit/pkg/nvcdi/spec" "tags.cncf.io/container-device-interface/pkg/cdi" "tags.cncf.io/container-device-interface/specs-go" + + "github.com/NVIDIA/nvidia-container-toolkit/internal/edits" + "github.com/NVIDIA/nvidia-container-toolkit/pkg/nvcdi/spec" ) type nvmllib nvcdilib diff --git a/pkg/nvcdi/lib-wsl.go b/pkg/nvcdi/lib-wsl.go index b2ecf173..b01c8268 100644 --- a/pkg/nvcdi/lib-wsl.go +++ b/pkg/nvcdi/lib-wsl.go @@ -20,10 +20,11 @@ import ( "fmt" "github.com/NVIDIA/go-nvlib/pkg/nvlib/device" - "github.com/NVIDIA/nvidia-container-toolkit/internal/edits" - "github.com/NVIDIA/nvidia-container-toolkit/pkg/nvcdi/spec" "tags.cncf.io/container-device-interface/pkg/cdi" "tags.cncf.io/container-device-interface/specs-go" + + "github.com/NVIDIA/nvidia-container-toolkit/internal/edits" + "github.com/NVIDIA/nvidia-container-toolkit/pkg/nvcdi/spec" ) type wsllib nvcdilib diff --git a/pkg/nvcdi/lib.go b/pkg/nvcdi/lib.go index 3839697c..2424c84b 100644 --- a/pkg/nvcdi/lib.go +++ b/pkg/nvcdi/lib.go @@ -22,6 +22,7 @@ import ( "github.com/NVIDIA/go-nvlib/pkg/nvlib/device" "github.com/NVIDIA/go-nvlib/pkg/nvlib/info" "github.com/NVIDIA/go-nvlib/pkg/nvml" + "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" "github.com/NVIDIA/nvidia-container-toolkit/internal/lookup/root" "github.com/NVIDIA/nvidia-container-toolkit/internal/platform-support/tegra/csv" diff --git a/pkg/nvcdi/management.go b/pkg/nvcdi/management.go index 460a4873..36b4b27b 100644 --- a/pkg/nvcdi/management.go +++ b/pkg/nvcdi/management.go @@ -22,12 +22,13 @@ import ( "strings" "github.com/NVIDIA/go-nvlib/pkg/nvlib/device" + "tags.cncf.io/container-device-interface/pkg/cdi" + "tags.cncf.io/container-device-interface/specs-go" + "github.com/NVIDIA/nvidia-container-toolkit/internal/discover" "github.com/NVIDIA/nvidia-container-toolkit/internal/edits" "github.com/NVIDIA/nvidia-container-toolkit/internal/lookup/cuda" "github.com/NVIDIA/nvidia-container-toolkit/pkg/nvcdi/spec" - "tags.cncf.io/container-device-interface/pkg/cdi" - "tags.cncf.io/container-device-interface/specs-go" ) type managementlib nvcdilib diff --git a/pkg/nvcdi/mig-device-nvml.go b/pkg/nvcdi/mig-device-nvml.go index db8601d9..aa51a0f7 100644 --- a/pkg/nvcdi/mig-device-nvml.go +++ b/pkg/nvcdi/mig-device-nvml.go @@ -21,12 +21,13 @@ import ( "github.com/NVIDIA/go-nvlib/pkg/nvlib/device" "github.com/NVIDIA/go-nvlib/pkg/nvml" + "tags.cncf.io/container-device-interface/pkg/cdi" + "tags.cncf.io/container-device-interface/specs-go" + "github.com/NVIDIA/nvidia-container-toolkit/internal/discover" "github.com/NVIDIA/nvidia-container-toolkit/internal/edits" "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" "github.com/NVIDIA/nvidia-container-toolkit/internal/nvcaps" - "tags.cncf.io/container-device-interface/pkg/cdi" - "tags.cncf.io/container-device-interface/specs-go" ) // GetMIGDeviceSpecs returns the CDI device specs for the full GPU represented by 'device'. diff --git a/pkg/nvcdi/mofed.go b/pkg/nvcdi/mofed.go index 39b0f537..3f56b2d5 100644 --- a/pkg/nvcdi/mofed.go +++ b/pkg/nvcdi/mofed.go @@ -20,11 +20,12 @@ import ( "fmt" "github.com/NVIDIA/go-nvlib/pkg/nvlib/device" + "tags.cncf.io/container-device-interface/pkg/cdi" + "tags.cncf.io/container-device-interface/specs-go" + "github.com/NVIDIA/nvidia-container-toolkit/internal/discover" "github.com/NVIDIA/nvidia-container-toolkit/internal/edits" "github.com/NVIDIA/nvidia-container-toolkit/pkg/nvcdi/spec" - "tags.cncf.io/container-device-interface/pkg/cdi" - "tags.cncf.io/container-device-interface/specs-go" ) type mofedlib nvcdilib diff --git a/pkg/nvcdi/namer_nvml_mock.go b/pkg/nvcdi/namer_nvml_mock.go index 4cc958f7..68bc1782 100644 --- a/pkg/nvcdi/namer_nvml_mock.go +++ b/pkg/nvcdi/namer_nvml_mock.go @@ -4,8 +4,9 @@ package nvcdi import ( - "github.com/NVIDIA/go-nvlib/pkg/nvml" "sync" + + "github.com/NVIDIA/go-nvlib/pkg/nvml" ) // Ensure, that nvmlUUIDerMock does implement nvmlUUIDer. diff --git a/pkg/nvcdi/options.go b/pkg/nvcdi/options.go index 86bb877d..e1c7cf52 100644 --- a/pkg/nvcdi/options.go +++ b/pkg/nvcdi/options.go @@ -19,6 +19,7 @@ package nvcdi import ( "github.com/NVIDIA/go-nvlib/pkg/nvlib/device" "github.com/NVIDIA/go-nvlib/pkg/nvml" + "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" "github.com/NVIDIA/nvidia-container-toolkit/pkg/nvcdi/transform" ) diff --git a/pkg/nvcdi/spec/builder.go b/pkg/nvcdi/spec/builder.go index c6930800..8fb80a68 100644 --- a/pkg/nvcdi/spec/builder.go +++ b/pkg/nvcdi/spec/builder.go @@ -20,10 +20,11 @@ import ( "fmt" "os" - "github.com/NVIDIA/nvidia-container-toolkit/pkg/nvcdi/transform" "tags.cncf.io/container-device-interface/pkg/cdi" "tags.cncf.io/container-device-interface/pkg/parser" "tags.cncf.io/container-device-interface/specs-go" + + "github.com/NVIDIA/nvidia-container-toolkit/pkg/nvcdi/transform" ) type builder struct { diff --git a/pkg/nvcdi/transform/noop/no-op.go b/pkg/nvcdi/transform/noop/no-op.go index 3b90b61b..8b7fe890 100644 --- a/pkg/nvcdi/transform/noop/no-op.go +++ b/pkg/nvcdi/transform/noop/no-op.go @@ -17,8 +17,9 @@ package noop import ( - "github.com/NVIDIA/nvidia-container-toolkit/pkg/nvcdi/transform" "tags.cncf.io/container-device-interface/specs-go" + + "github.com/NVIDIA/nvidia-container-toolkit/pkg/nvcdi/transform" ) type noop struct{} diff --git a/pkg/nvcdi/transform/root/container-root.go b/pkg/nvcdi/transform/root/container-root.go index e57583c2..b8d76f92 100644 --- a/pkg/nvcdi/transform/root/container-root.go +++ b/pkg/nvcdi/transform/root/container-root.go @@ -20,8 +20,9 @@ import ( "fmt" "strings" - "github.com/NVIDIA/nvidia-container-toolkit/pkg/nvcdi/transform" "tags.cncf.io/container-device-interface/specs-go" + + "github.com/NVIDIA/nvidia-container-toolkit/pkg/nvcdi/transform" ) // containerRootTransformer transforms the roots of container paths in a CDI spec. diff --git a/pkg/nvcdi/transform/root/host-root.go b/pkg/nvcdi/transform/root/host-root.go index ca5f7883..9d2b54d3 100644 --- a/pkg/nvcdi/transform/root/host-root.go +++ b/pkg/nvcdi/transform/root/host-root.go @@ -20,8 +20,9 @@ import ( "fmt" "strings" - "github.com/NVIDIA/nvidia-container-toolkit/pkg/nvcdi/transform" "tags.cncf.io/container-device-interface/specs-go" + + "github.com/NVIDIA/nvidia-container-toolkit/pkg/nvcdi/transform" ) // hostRootTransformer transforms the roots of host paths in a CDI spec. diff --git a/tools/container/container.go b/tools/container/container.go index 4cba08f0..c2c50c5b 100644 --- a/tools/container/container.go +++ b/tools/container/container.go @@ -21,10 +21,11 @@ import ( "os" "os/exec" - "github.com/NVIDIA/nvidia-container-toolkit/pkg/config/engine" - "github.com/NVIDIA/nvidia-container-toolkit/tools/container/operator" "github.com/sirupsen/logrus" "github.com/urfave/cli/v2" + + "github.com/NVIDIA/nvidia-container-toolkit/pkg/config/engine" + "github.com/NVIDIA/nvidia-container-toolkit/tools/container/operator" ) const ( diff --git a/tools/container/containerd/config_v1_test.go b/tools/container/containerd/config_v1_test.go index 3430e781..81c4ff59 100644 --- a/tools/container/containerd/config_v1_test.go +++ b/tools/container/containerd/config_v1_test.go @@ -20,10 +20,11 @@ import ( "fmt" "testing" - "github.com/NVIDIA/nvidia-container-toolkit/pkg/config/engine/containerd" - "github.com/NVIDIA/nvidia-container-toolkit/tools/container" "github.com/pelletier/go-toml" "github.com/stretchr/testify/require" + + "github.com/NVIDIA/nvidia-container-toolkit/pkg/config/engine/containerd" + "github.com/NVIDIA/nvidia-container-toolkit/tools/container" ) func TestUpdateV1ConfigDefaultRuntime(t *testing.T) { diff --git a/tools/container/containerd/config_v2_test.go b/tools/container/containerd/config_v2_test.go index a1b7413e..dd65f253 100644 --- a/tools/container/containerd/config_v2_test.go +++ b/tools/container/containerd/config_v2_test.go @@ -20,10 +20,11 @@ import ( "fmt" "testing" - "github.com/NVIDIA/nvidia-container-toolkit/pkg/config/engine/containerd" - "github.com/NVIDIA/nvidia-container-toolkit/tools/container" "github.com/pelletier/go-toml" "github.com/stretchr/testify/require" + + "github.com/NVIDIA/nvidia-container-toolkit/pkg/config/engine/containerd" + "github.com/NVIDIA/nvidia-container-toolkit/tools/container" ) const ( diff --git a/tools/container/containerd/containerd.go b/tools/container/containerd/containerd.go index 5e4e1a7a..bfe055e5 100644 --- a/tools/container/containerd/containerd.go +++ b/tools/container/containerd/containerd.go @@ -20,11 +20,12 @@ import ( "fmt" "os" + log "github.com/sirupsen/logrus" + cli "github.com/urfave/cli/v2" + "github.com/NVIDIA/nvidia-container-toolkit/internal/info" "github.com/NVIDIA/nvidia-container-toolkit/pkg/config/engine/containerd" "github.com/NVIDIA/nvidia-container-toolkit/tools/container" - log "github.com/sirupsen/logrus" - cli "github.com/urfave/cli/v2" ) const ( diff --git a/tools/container/crio/crio.go b/tools/container/crio/crio.go index 60f5cda8..653998c7 100644 --- a/tools/container/crio/crio.go +++ b/tools/container/crio/crio.go @@ -21,13 +21,14 @@ import ( "os" "path/filepath" + log "github.com/sirupsen/logrus" + cli "github.com/urfave/cli/v2" + "github.com/NVIDIA/nvidia-container-toolkit/internal/config" "github.com/NVIDIA/nvidia-container-toolkit/internal/info" "github.com/NVIDIA/nvidia-container-toolkit/pkg/config/engine/crio" "github.com/NVIDIA/nvidia-container-toolkit/pkg/config/ocihook" "github.com/NVIDIA/nvidia-container-toolkit/tools/container" - log "github.com/sirupsen/logrus" - cli "github.com/urfave/cli/v2" ) const ( diff --git a/tools/container/docker/docker.go b/tools/container/docker/docker.go index 889267d8..9ae92f86 100644 --- a/tools/container/docker/docker.go +++ b/tools/container/docker/docker.go @@ -20,11 +20,12 @@ import ( "fmt" "os" + log "github.com/sirupsen/logrus" + cli "github.com/urfave/cli/v2" + "github.com/NVIDIA/nvidia-container-toolkit/internal/info" "github.com/NVIDIA/nvidia-container-toolkit/pkg/config/engine/docker" "github.com/NVIDIA/nvidia-container-toolkit/tools/container" - log "github.com/sirupsen/logrus" - cli "github.com/urfave/cli/v2" ) const ( diff --git a/tools/container/docker/docker_test.go b/tools/container/docker/docker_test.go index 83aa33a4..20c66d0d 100644 --- a/tools/container/docker/docker_test.go +++ b/tools/container/docker/docker_test.go @@ -20,9 +20,10 @@ import ( "encoding/json" "testing" + "github.com/stretchr/testify/require" + "github.com/NVIDIA/nvidia-container-toolkit/pkg/config/engine/docker" "github.com/NVIDIA/nvidia-container-toolkit/tools/container" - "github.com/stretchr/testify/require" ) func TestUpdateConfigDefaultRuntime(t *testing.T) { diff --git a/tools/container/toolkit/toolkit.go b/tools/container/toolkit/toolkit.go index 473d7ca7..75b4629c 100644 --- a/tools/container/toolkit/toolkit.go +++ b/tools/container/toolkit/toolkit.go @@ -23,15 +23,16 @@ import ( "path/filepath" "strings" - "github.com/NVIDIA/nvidia-container-toolkit/internal/config" - "github.com/NVIDIA/nvidia-container-toolkit/internal/system/nvdevices" - "github.com/NVIDIA/nvidia-container-toolkit/pkg/nvcdi" - transformroot "github.com/NVIDIA/nvidia-container-toolkit/pkg/nvcdi/transform/root" toml "github.com/pelletier/go-toml" log "github.com/sirupsen/logrus" "github.com/urfave/cli/v2" "tags.cncf.io/container-device-interface/pkg/cdi" "tags.cncf.io/container-device-interface/pkg/parser" + + "github.com/NVIDIA/nvidia-container-toolkit/internal/config" + "github.com/NVIDIA/nvidia-container-toolkit/internal/system/nvdevices" + "github.com/NVIDIA/nvidia-container-toolkit/pkg/nvcdi" + transformroot "github.com/NVIDIA/nvidia-container-toolkit/pkg/nvcdi/transform/root" ) const (