mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-04-23 15:44:24 +00:00
[no-relnotes] Update moq to use rm and goimports
Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
parent
57f077fce7
commit
2a9bae8e80
@ -38,7 +38,7 @@ type Hook struct {
|
|||||||
|
|
||||||
// Discover defines an interface for discovering the devices, mounts, and hooks available on a system
|
// Discover defines an interface for discovering the devices, mounts, and hooks available on a system
|
||||||
//
|
//
|
||||||
//go:generate moq -stub -out discover_mock.go . Discover
|
//go:generate moq -rm -fmt=goimports -stub -out discover_mock.go . Discover
|
||||||
type Discover interface {
|
type Discover interface {
|
||||||
Devices() ([]Device, error)
|
Devices() ([]Device, error)
|
||||||
Mounts() ([]Mount, error)
|
Mounts() ([]Mount, error)
|
||||||
|
@ -49,7 +49,7 @@ type Major int
|
|||||||
|
|
||||||
// Devices represents the set of devices under /proc/devices
|
// Devices represents the set of devices under /proc/devices
|
||||||
//
|
//
|
||||||
//go:generate moq -stub -out devices_mock.go . Devices
|
//go:generate moq -rm -fmt=goimports -stub -out devices_mock.go . Devices
|
||||||
type Devices interface {
|
type Devices interface {
|
||||||
Exists(Name) bool
|
Exists(Name) bool
|
||||||
Get(Name) (Major, bool)
|
Get(Name) (Major, bool)
|
||||||
|
@ -79,7 +79,7 @@ type entry2 struct {
|
|||||||
|
|
||||||
// LDCache represents the interface for performing lookups into the LDCache
|
// LDCache represents the interface for performing lookups into the LDCache
|
||||||
//
|
//
|
||||||
//go:generate moq -rm -out ldcache_mock.go . LDCache
|
//go:generate moq -rm -fmt=goimports -out ldcache_mock.go . LDCache
|
||||||
type LDCache interface {
|
type LDCache interface {
|
||||||
List() ([]string, []string)
|
List() ([]string, []string)
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ package lookup
|
|||||||
|
|
||||||
import "errors"
|
import "errors"
|
||||||
|
|
||||||
//go:generate moq -stub -out locator_mock.go . Locator
|
//go:generate moq -rm -fmt=goimports -stub -out locator_mock.go . Locator
|
||||||
|
|
||||||
// Locator defines the interface for locating files on a system.
|
// Locator defines the interface for locating files on a system.
|
||||||
type Locator interface {
|
type Locator interface {
|
||||||
|
@ -167,7 +167,7 @@ func generateInterfaceComment(input GeneratableInterfacePoperties) (string, erro
|
|||||||
commentFmt := []string{
|
commentFmt := []string{
|
||||||
"// %s represents the interface for the %s type.",
|
"// %s represents the interface for the %s type.",
|
||||||
"//",
|
"//",
|
||||||
"//go:generate moq -out mock/%s.go -pkg mock . %s:%s",
|
"//go:generate moq -rm -fmt=goimports -out mock/%s.go -pkg mock . %s:%s",
|
||||||
}
|
}
|
||||||
|
|
||||||
var signature strings.Builder
|
var signature strings.Builder
|
||||||
|
@ -35,7 +35,7 @@ var errLibraryAlreadyLoaded = errors.New("library already loaded")
|
|||||||
// dynamicLibrary is an interface for abstacting the underlying library.
|
// dynamicLibrary is an interface for abstacting the underlying library.
|
||||||
// This also allows for mocking and testing.
|
// This also allows for mocking and testing.
|
||||||
|
|
||||||
//go:generate moq -rm -stub -out dynamicLibrary_mock.go . dynamicLibrary
|
//go:generate moq -rm -fmt=goimports -stub -out dynamicLibrary_mock.go . dynamicLibrary
|
||||||
type dynamicLibrary interface {
|
type dynamicLibrary interface {
|
||||||
Lookup(string) error
|
Lookup(string) error
|
||||||
Open() error
|
Open() error
|
||||||
|
@ -4,8 +4,9 @@
|
|||||||
package mock
|
package mock
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/NVIDIA/nvidia-container-toolkit/internal/nvsandboxutils"
|
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/NVIDIA/nvidia-container-toolkit/internal/nvsandboxutils"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Ensure, that Interface does implement nvsandboxutils.Interface.
|
// Ensure, that Interface does implement nvsandboxutils.Interface.
|
||||||
|
@ -31,7 +31,7 @@ var (
|
|||||||
|
|
||||||
// Interface represents the interface for the library type.
|
// Interface represents the interface for the library type.
|
||||||
//
|
//
|
||||||
//go:generate moq -out mock/interface.go -pkg mock . Interface:Interface
|
//go:generate moq -rm -fmt=goimports -out mock/interface.go -pkg mock . Interface:Interface
|
||||||
type Interface interface {
|
type Interface interface {
|
||||||
ErrorString(Ret) string
|
ErrorString(Ret) string
|
||||||
GetDriverVersion() (string, Ret)
|
GetDriverVersion() (string, Ret)
|
||||||
|
@ -19,7 +19,7 @@ package oci
|
|||||||
// Runtime is an interface for a runtime shim. The Exec method accepts a list
|
// Runtime is an interface for a runtime shim. The Exec method accepts a list
|
||||||
// of command line arguments, and returns an error / nil.
|
// of command line arguments, and returns an error / nil.
|
||||||
//
|
//
|
||||||
//go:generate moq -rm -stub -out runtime_mock.go . Runtime
|
//go:generate moq -rm -fmt=goimports -stub -out runtime_mock.go . Runtime
|
||||||
type Runtime interface {
|
type Runtime interface {
|
||||||
Exec([]string) error
|
Exec([]string) error
|
||||||
String() string
|
String() string
|
||||||
|
@ -33,7 +33,7 @@ type SpecModifier interface {
|
|||||||
|
|
||||||
// Spec defines the operations to be performed on an OCI specification
|
// Spec defines the operations to be performed on an OCI specification
|
||||||
//
|
//
|
||||||
//go:generate moq -stub -out spec_mock.go . Spec
|
//go:generate moq -rm -fmt=goimports -stub -out spec_mock.go . Spec
|
||||||
type Spec interface {
|
type Spec interface {
|
||||||
Load() (*specs.Spec, error)
|
Load() (*specs.Spec, error)
|
||||||
Flush() error
|
Flush() error
|
||||||
|
@ -18,7 +18,7 @@ package constraints
|
|||||||
|
|
||||||
// Constraint represents a constraint that is to be evaluated
|
// Constraint represents a constraint that is to be evaluated
|
||||||
//
|
//
|
||||||
//go:generate moq -stub -out constraint_mock.go . Constraint
|
//go:generate moq -rm -fmt=goimports -stub -out constraint_mock.go . Constraint
|
||||||
type Constraint interface {
|
type Constraint interface {
|
||||||
String() string
|
String() string
|
||||||
Assert() error
|
Assert() error
|
||||||
|
@ -25,7 +25,7 @@ import (
|
|||||||
|
|
||||||
// Property represents a property that is used to check requirements
|
// Property represents a property that is used to check requirements
|
||||||
//
|
//
|
||||||
//go:generate moq -stub -out property_mock.go . Property
|
//go:generate moq -rm -fmt=goimports -stub -out property_mock.go . Property
|
||||||
type Property interface {
|
type Property interface {
|
||||||
Name() string
|
Name() string
|
||||||
Value() (string, error)
|
Value() (string, error)
|
||||||
|
@ -25,7 +25,7 @@ import (
|
|||||||
"github.com/NVIDIA/nvidia-container-toolkit/internal/logger"
|
"github.com/NVIDIA/nvidia-container-toolkit/internal/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:generate moq -stub -out mknod_mock.go . mknoder
|
//go:generate moq -rm -fmt=goimports -stub -out mknod_mock.go . mknoder
|
||||||
type mknoder interface {
|
type mknoder interface {
|
||||||
Mknode(string, int, int) error
|
Mknode(string, int, int) error
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ import (
|
|||||||
"github.com/NVIDIA/nvidia-container-toolkit/internal/logger"
|
"github.com/NVIDIA/nvidia-container-toolkit/internal/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:generate moq -stub -out cmd_mock.go . cmder
|
//go:generate moq -rm -fmt=goimports -stub -out cmd_mock.go . cmder
|
||||||
type cmder interface {
|
type cmder interface {
|
||||||
// Run executes the command and returns the stdout, stderr, and an error if any
|
// Run executes the command and returns the stdout, stderr, and an error if any
|
||||||
Run(string, ...string) error
|
Run(string, ...string) error
|
||||||
|
@ -96,7 +96,7 @@ func (s deviceNameUUID) GetMigDeviceName(i int, _ UUIDer, j int, mig UUIDer) (st
|
|||||||
return uuid, nil
|
return uuid, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:generate moq -stub -out namer_nvml_mock.go . nvmlUUIDer
|
//go:generate moq -rm -fmt=goimports -stub -out namer_nvml_mock.go . nvmlUUIDer
|
||||||
type nvmlUUIDer interface {
|
type nvmlUUIDer interface {
|
||||||
GetUUID() (string, nvml.Return)
|
GetUUID() (string, nvml.Return)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user