Skip to content

Commit

Permalink
Merge pull request #4594 from twz123/backport-linter-to-release-1.27
Browse files Browse the repository at this point in the history
[Backport release-1.27] Bump golangci-lint to v1.57.1
  • Loading branch information
twz123 authored Jun 12, 2024
2 parents 6a44f9f + 9f9c594 commit c090fb7
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 22 deletions.
54 changes: 33 additions & 21 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
# options for analysis running
run:
timeout: 8m
timeout: 15m

build-tags:
- hack
skip-dirs-use-default: false
skip-dirs:
- build
- docs
- embedded-bins
- examples
skip-files:
- "zz_*"
tests: true
modules-download-mode: readonly
allow-parallel-runners: true
Expand All @@ -25,27 +17,47 @@ linters:

linters-settings:
depguard:
packages:
- gopkg.in/yaml*
additional-guards:
# Only allow usages of the k8s cloud provider from within the k0s cloud
# provider package. This is to ensure that it's not leaking global flags
# into k0s.
- packages:
- k8s.io/cloud-provider*
ignore-file-rules:
- "**/pkg/k0scloudprovider/*.go"
golint:
min-confidence: 0
rules:
yaml:
list-mode: lax
deny:
- pkg: gopkg.in/yaml.v2
desc: Use sigs.k8s.io/yaml.
- pkg: gopkg.in/yaml.v3
desc: Use sigs.k8s.io/yaml.
cloud-provider:
list-mode: lax
files:
- "!**/pkg/k0scloudprovider/*.go"
deny:
- pkg: k8s.io/cloud-provider
desc: >-
Usages of the k8s cloud provider are only allowed from within the
k0s cloud provider package. This is to ensure that it's not
leaking global flags into k0s.
goheader:
template-path: .go-header.txt
values:
regexp:
year: 202[0-9]

revive:
rules:
# This forbids to name variables "close", which seems natural for "close" functions.
- name: redefines-builtin-id
disabled: true

issues:
max-issues-per-linter: 0
max-same-issues: 0
exclude-dirs-use-default: false
exclude-dirs:
- build
- docs
- embedded-bins
- examples
exclude-files:
- "zz_*"
exclude-rules:
# https://github.com/denis-tingaikin/go-header/issues/18
# This means that the header checks are ineffective for all files with build tags.
Expand Down
2 changes: 1 addition & 1 deletion hack/tools/Makefile.variables
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
controller-gen_version = 0.11.3
go-bindata_version = 3.23.0+incompatible
golangci-lint_version = 1.51.1
golangci-lint_version = 1.57.1
1 change: 1 addition & 0 deletions internal/pkg/sysinfo/probes/linux/cgroup_controllers.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ type cgroupControllerProbe struct {

func (c *cgroupControllerProbe) Probe(reporter probes.Reporter) error {
desc := probes.NewProbeDesc(fmt.Sprintf("cgroup controller %q", c.name), c.path)
//revive:disable:indent-error-flow
if sys, err := c.probeSystem(); err != nil {
return reportCgroupSystemErr(reporter, desc, err)
} else if available, err := sys.probeController(c.name); err != nil {
Expand Down
1 change: 1 addition & 0 deletions internal/pkg/sysinfo/probes/linux/kernel.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func (l *LinuxProbes) AssertKernelRelease(assert func(string) string) {
l.Set("kernelRelease", func(path probes.ProbePath, current probes.Probe) probes.Probe {
return probes.ProbeFn(func(r probes.Reporter) error {
desc := probes.NewProbeDesc("Linux kernel release", path)
//revive:disable:indent-error-flow
if uname, err := l.probeUname(); err != nil {
return r.Error(desc, err)
} else if uname.osRelease.truncated {
Expand Down
1 change: 1 addition & 0 deletions internal/pkg/sysinfo/probes/linux/linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ func (l *LinuxProbes) Probe(reporter probes.Reporter) error {

func (l *LinuxProbes) probe(reporter probes.Reporter) error {
desc := probes.NewProbeDesc("Operating system", l.path)
//revive:disable:indent-error-flow
if uname, err := l.probeUname(); err != nil {
return reporter.Error(desc, err)
} else if uname.osName.value == "Linux" {
Expand Down

0 comments on commit c090fb7

Please sign in to comment.