Skip to content

Enable linters for enforce-switch-style & redundant-test-main-exit#4496

Open
space-aditya wants to merge 3 commits into
containerd:mainfrom
space-aditya:refactor/resolve-linting-issues
Open

Enable linters for enforce-switch-style & redundant-test-main-exit#4496
space-aditya wants to merge 3 commits into
containerd:mainfrom
space-aditya:refactor/resolve-linting-issues

Conversation

@space-aditya

Copy link
Copy Markdown

Resolves #4493, in parts.

  • enabled redundant-test-main-exit & enforce-switch-style in golangci file.
  • updated code to resolve warnings
    • added errors if relevant
    • moved returns to default
    • blank default case otherwise.

Signed-off-by: Aditya <jaiswal.aditya.deelip@gmail.com>
Signed-off-by: Aditya <jaiswal.aditya.deelip@gmail.com>
fmt.Fprintln(os.Stderr, file)
}

exitCode = 1

@AkihiroSuda AkihiroSuda Sep 1, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is irrelevant to redundant-test-main-exit

fmt.Fprintln(os.Stderr, "Leaking go routines")
fmt.Fprintln(os.Stderr, os.Stderr, err.Error())

exitCode = 1

@AkihiroSuda AkihiroSuda Sep 1, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is irrelevant to redundant-test-main-exit

fmt.Fprintln(os.Stderr, file)
}

exitCode = 1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is irrelevant to redundant-test-main-exit

fmt.Fprintln(os.Stderr, "Leaking go routines")
fmt.Fprintln(os.Stderr, err.Error())

exitCode = 1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is irrelevant to redundant-test-main-exit

Comment thread mod/tigron/.golangci.yml Outdated
Comment thread .golangci.yml Outdated
@@ -185,9 +185,6 @@ linters:
# 2605 occurrences. Kind of useful in itself, but unacceptable amount of effort to fix
disabled: true
- name: enforce-switch-style

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line can be removed

switch base.Info().CgroupDriver {
case "none", "":
t.Skip("requires cgroup (for pausing)")
default:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: add // NOP to clarify that this empty default is not a typo

default:
  // NOP

Same for other occurrences too

Comment thread mod/tigron/.golangci.yml Outdated
Signed-off-by: Aditya <jaiswal.aditya.deelip@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor code to enable some lint checks

2 participants