Skip to content

Commit

Permalink
Enable nolintlint linter
Browse files Browse the repository at this point in the history
... and fix lints on the way.

Simplify the utsChar declaration, as it's only needed once and can be
addressed by a single type alias.

Signed-off-by: Tom Wieczorek <[email protected]>
  • Loading branch information
twz123 committed Nov 13, 2024
1 parent cb11f57 commit d80e048
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 9 deletions.
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ linters:
- errorlint # Find code that will cause problems with Go's error wrapping scheme
- gofmt # Checks whether code was gofmt-ed
- goheader # Checks is file headers matche a given pattern
- nolintlint # Find ill-formed or insufficiently explained nolint directives
- revive # Stricter drop-in replacement for golint

linters-settings:
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/sysinfo/probes/linux/linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func newUnameProber() unameProber {
}

func parseUname(utsname *syscall.Utsname) *uname {
convert := func(chars utsStringPtr) unameField {
convert := func(chars *[65]utsChar) unameField {
var buf [65]byte
var i int
for pos, ch := range *chars {
Expand Down
4 changes: 1 addition & 3 deletions internal/pkg/sysinfo/probes/linux/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,4 @@ limitations under the License.

package linux

func utsChar(ch rune) int8 { return int8(ch) } //nolint:deadcode,unused // just for tests 🙄

type utsStringPtr *[65]int8
type utsChar = int8
4 changes: 1 addition & 3 deletions internal/pkg/sysinfo/probes/linux/types_arm.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,4 @@ limitations under the License.

package linux

func utsChar(ch rune) uint8 { return uint8(ch) } //nolint:deadcode,unused // just for tests 🙄

type utsStringPtr *[65]uint8
type utsChar = uint8
1 change: 0 additions & 1 deletion pkg/autopilot/controller/root/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
)

// TODO: decide on renaming root.RootConfig -> root.Config
// nolint:revive
type RootConfig struct {
InvocationID string
KubeConfig string
Expand Down
2 changes: 1 addition & 1 deletion pkg/component/controller/workerconfig/reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ func TestReconciler_runReconcileLoop(t *testing.T) {

underTest.runReconcileLoop(ctx, updates, nil)

switch ctx.Err() { //nolint:errorlint // as per context contract
switch ctx.Err() {
case context.Canceled:
break // this is the good case
case context.DeadlineExceeded:
Expand Down

0 comments on commit d80e048

Please sign in to comment.