Skip to content

Commit

Permalink
Merge pull request #3755 from twz123/bump-golangci-lint
Browse files Browse the repository at this point in the history
Bump golangci-lint to v1.55.2
  • Loading branch information
twz123 authored Nov 28, 2023
2 parents 82202b3 + 0873cfe commit 20b7986
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 11 deletions.
34 changes: 24 additions & 10 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,24 @@ 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"
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.
golint:
min-confidence: 0
goheader:
Expand All @@ -43,6 +51,12 @@ linters-settings:
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
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.13.0
go-bindata_version = 3.23.0+incompatible
golangci-lint_version = 1.51.2
golangci-lint_version = 1.55.2
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 @@ -55,6 +55,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 @@ -37,6 +37,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 @@ -70,6 +70,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 20b7986

Please sign in to comment.