Fix exported comments enforcer in CI

Add comments where missing and fix incorrect comments

Signed-off-by: Derek McGowan <derek@mcg.dev>
This commit is contained in:
Derek McGowan
2021-03-08 15:36:42 -08:00
parent 031775ee5e
commit 35eeb24a17
26 changed files with 65 additions and 14 deletions

View File

@@ -1172,8 +1172,6 @@ func WithLinuxDevices(devices []specs.LinuxDevice) SpecOpts {
}
}
var ErrNotADevice = errors.New("not a device node")
// WithLinuxDevice adds the device specified by path to the spec
func WithLinuxDevice(path, permissions string) SpecOpts {
return func(_ context.Context, _ Client, _ *containers.Container, s *Spec) error {

View File

@@ -27,6 +27,7 @@ import (
"github.com/containerd/containerd/containers"
"github.com/containerd/containerd/pkg/cap"
specs "github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors"
"golang.org/x/sys/unix"
)
@@ -42,6 +43,8 @@ func WithHostDevices(_ context.Context, _ Client, _ *containers.Container, s *Sp
return nil
}
var errNotADevice = errors.New("not a device node")
func getDevices(path string) ([]specs.LinuxDevice, error) {
files, err := ioutil.ReadDir(path)
if err != nil {
@@ -70,7 +73,7 @@ func getDevices(path string) ([]specs.LinuxDevice, error) {
}
device, err := deviceFromPath(filepath.Join(path, f.Name()), "rwm")
if err != nil {
if err == ErrNotADevice {
if err == errNotADevice {
continue
}
if os.IsNotExist(err) {
@@ -96,7 +99,7 @@ func deviceFromPath(path, permissions string) (*specs.LinuxDevice, error) {
minor = unix.Minor(devNumber)
)
if major == 0 {
return nil, ErrNotADevice
return nil, errNotADevice
}
var (

View File

@@ -26,6 +26,7 @@ import (
"github.com/containerd/containerd/containers"
specs "github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors"
"golang.org/x/sys/unix"
)
@@ -41,6 +42,8 @@ func WithHostDevices(_ context.Context, _ Client, _ *containers.Container, s *Sp
return nil
}
var errNotADevice = errors.New("not a device node")
func getDevices(path string) ([]specs.LinuxDevice, error) {
files, err := ioutil.ReadDir(path)
if err != nil {
@@ -69,7 +72,7 @@ func getDevices(path string) ([]specs.LinuxDevice, error) {
}
device, err := deviceFromPath(filepath.Join(path, f.Name()), "rwm")
if err != nil {
if err == ErrNotADevice {
if err == errNotADevice {
continue
}
if os.IsNotExist(err) {
@@ -94,7 +97,7 @@ func deviceFromPath(path, permissions string) (*specs.LinuxDevice, error) {
minor = unix.Minor(devNumber)
)
if major == 0 {
return nil, ErrNotADevice
return nil, errNotADevice
}
var (