Skip to content

Commit b614d28

Browse files
committed
Enable dogsled and whitespace linters
The corresponding lints have been fixed as well. Signed-off-by: Sascha Grunert <[email protected]>
1 parent df667bf commit b614d28

File tree

16 files changed

+2
-31
lines changed

16 files changed

+2
-31
lines changed

.golangci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ linters:
1717
- bodyclose
1818
- deadcode
1919
- depguard
20+
- dogsled
2021
- dupl
2122
- errcheck
2223
- gochecknoinits
@@ -44,13 +45,12 @@ linters:
4445
- unparam
4546
- unused
4647
- varcheck
47-
# - dogsled
48+
- whitespace
4849
# - funlen
4950
# - gochecknoglobals
5051
# - gocognit
5152
# - godox
5253
# - lll
53-
# - whitespace
5454
# - wsl
5555
linters-settings:
5656
errcheck:

cmd/crio/main.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ func writeCrioGoroutineStacks() {
4444
}
4545

4646
func catchShutdown(ctx context.Context, cancel context.CancelFunc, gserver *grpc.Server, sserver *server.Server, hserver *http.Server, signalled *bool) {
47-
4847
sig := make(chan os.Signal, 2048)
4948
signal.Notify(sig, signals.Interrupt, signals.Term, unix.SIGUSR1, unix.SIGPIPE, signals.Hup)
5049
go func() {

internal/lib/config/config.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,6 @@ func (r *RuntimeHandler) ValidateRuntimePath(name string) error {
798798
}
799799
r.RuntimePath = executable
800800
logrus.Debugf("using runtime executable from $PATH %q", executable)
801-
802801
} else if _, err := os.Stat(r.RuntimePath); os.IsNotExist(err) {
803802
return fmt.Errorf("invalid runtime_path for runtime '%s': %q",
804803
name, err)

internal/oci/container.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,6 @@ func (c *Container) AddVolume(v ContainerVolume) {
298298
// Volumes returns the list of container volumes.
299299
func (c *Container) Volumes() []ContainerVolume {
300300
return c.volumes
301-
302301
}
303302

304303
// SetMountPoint sets the container mount point

internal/oci/kill.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,4 @@ func findStringInSignalMap(killSignal syscall.Signal) (string, error) {
1515
}
1616
}
1717
return "", errors.Errorf("unable to convert signal to string")
18-
1918
}

internal/oci/runtime_oci.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,6 @@ func (r *runtimeOCI) StartContainer(c *Container) error {
224224

225225
if err := utils.ExecCmdWithStdStreams(os.Stdin, os.Stdout, os.Stderr,
226226
r.path, rootFlag, r.root, "start", c.id); err != nil {
227-
228227
return err
229228
}
230229
c.state.Started = time.Now()
@@ -582,7 +581,6 @@ func (r *runtimeOCI) StopContainer(ctx context.Context, c *Container, timeout in
582581
if timeout > 0 {
583582
if err := utils.ExecCmdWithStdStreams(os.Stdin, os.Stdout, os.Stderr,
584583
r.path, rootFlag, r.root, "kill", c.id, c.GetStopSignal()); err != nil {
585-
586584
if err := checkProcessGone(c); err != nil {
587585
return fmt.Errorf("failed to stop container %q: %v", c.id, err)
588586
}
@@ -596,7 +594,6 @@ func (r *runtimeOCI) StopContainer(ctx context.Context, c *Container, timeout in
596594

597595
if err := utils.ExecCmdWithStdStreams(os.Stdin, os.Stdout, os.Stderr,
598596
r.path, rootFlag, r.root, "kill", c.id, "KILL"); err != nil {
599-
600597
if err := checkProcessGone(c); err != nil {
601598
return fmt.Errorf("failed to stop container %q: %v", c.id, err)
602599
}

internal/oci/runtime_vm.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,6 @@ func (r *runtimeVM) ExecSyncContainer(c *Container, command []string, timeout in
296296
}
297297

298298
func (r *runtimeVM) execContainerCommon(c *Container, cmd []string, timeout int64, stdin io.Reader, stdout, stderr io.WriteCloser, tty bool, resize <-chan remotecommand.TerminalSize) (exitCode int32, err error) {
299-
300299
logrus.Debug("runtimeVM.execContainer() start")
301300
defer logrus.Debug("runtimeVM.execContainer() end")
302301

internal/pkg/criocli/completion.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ func zshCompletion(c *cli.Context) error {
110110
strings.Join(opts, "' '"),
111111
c.App.Name))
112112
return nil
113-
114113
}
115114

116115
func fishCompletion(c *cli.Context) error {

internal/pkg/log/interceptors.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ func StreamInterceptor() grpc.StreamServerInterceptor {
3030
info *grpc.StreamServerInfo,
3131
handler grpc.StreamHandler,
3232
) error {
33-
3433
newCtx := addRequestID(stream.Context())
3534
newStream := NewServerStream(stream)
3635
newStream.NewContext = newCtx
@@ -52,7 +51,6 @@ func UnaryInterceptor() grpc.UnaryServerInterceptor {
5251
info *grpc.UnaryServerInfo,
5352
handler grpc.UnaryHandler,
5453
) (interface{}, error) {
55-
5654
newCtx := addRequestID(ctx)
5755
Debugf(newCtx, "request: %+v", req)
5856

server/container_create_linux.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,8 @@ func addDevicesPlatform(ctx context.Context, sb *sandbox.Sandbox, containerConfi
128128
// if the device is not a device node
129129
// try to see if it's a directory holding many devices
130130
if err == devices.ErrNotADevice {
131-
132131
// check if it is a directory
133132
if e := utils.IsDirectory(path); e == nil {
134-
135133
// mount the internal devices recursively
136134
// nolint: errcheck
137135
filepath.Walk(path, func(dpath string, f os.FileInfo, e error) error {
@@ -428,7 +426,6 @@ func (s *Server) createSandboxContainer(ctx context.Context, containerID, contai
428426

429427
// set this container's apparmor profile if it is set by sandbox
430428
if s.appArmorEnabled && !privileged {
431-
432429
appArmorProfileName := s.getAppArmorProfileName(containerConfig.GetLinux().GetSecurityContext().GetApparmorProfile())
433430
if appArmorProfileName != "" {
434431
// reload default apparmor profile if it is unloaded.
@@ -446,7 +443,6 @@ func (s *Server) createSandboxContainer(ctx context.Context, containerID, contai
446443

447444
specgen.SetProcessApparmorProfile(appArmorProfileName)
448445
}
449-
450446
}
451447

452448
logPath := containerConfig.GetLogPath()
@@ -1072,7 +1068,6 @@ func addOCIBindMounts(ctx context.Context, mountLabel string, containerConfig *p
10721068
Options: []string{"nosuid", "noexec", "nodev", "relatime", "ro"},
10731069
}
10741070
specgen.AddMount(m)
1075-
10761071
}
10771072

10781073
return volumes, ociMounts, nil

0 commit comments

Comments
 (0)