Skip to content

Commit

Permalink
chore(deps): update golangci-lint
Browse files Browse the repository at this point in the history
Signed-off-by: Sven Pfennig <[email protected]>
  • Loading branch information
0xE282B0 committed Jan 20, 2025
1 parent 830dc2b commit f57e58d
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 14 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version: "1.21"
go-version: "1.23"
- run: make test

golangci:
Expand All @@ -37,9 +37,9 @@ jobs:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version: "1.21"
go-version: "1.23"
- name: golangci-lint
uses: golangci/golangci-lint-action@ec5d18412c0aeab7936cb16880d708ba2a64e1ae # v6.2.0
with:
version: v1.57.2
version: v1.63.4
skip-cache: true
4 changes: 2 additions & 2 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -188,19 +188,19 @@ linters:
- asasalint # checks for pass []any as any in variadic func(...any)
- asciicheck # checks that your code does not contain non-ASCII identifiers
- bidichk # checks for dangerous unicode character sequences
- copyloopvar # Copyloopvar is a linter detects places where loop variables are copied.
- cyclop # checks function and package cyclomatic complexity
- dupl # tool for code clone detection
- errname # checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error
- errorlint # finds code that will cause problems with the error wrapping scheme introduced in Go 1.13
- exportloopref # checks for pointers to enclosing loop variables
- forbidigo # forbids identifiers
- funlen # tool for detection of long functions
- gocognit # computes and checks the cognitive complexity of functions
- goconst # finds repeated strings that could be replaced by a constant
- gocritic # provides diagnostics that check for bugs, performance and style issues
- gocyclo # computes and checks the cyclomatic complexity of functions
- goimports # in addition to fixing imports, goimports also formats your code in the same style as gofmt
- gomnd # detects magic numbers
- mnd # detects magic numbers
- goprintffuncname # checks that printf-like functions are named with f at the end
- gosec # inspects source code for security problems
- makezero # finds slice declarations with non-zero initial length
Expand Down
4 changes: 2 additions & 2 deletions internal/containerd/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (c *Config) AddRuntime(shimPath string) error {
}

// Open file in append mode
file, err := c.hostFs.OpenFile(c.configPath, os.O_APPEND|os.O_WRONLY, 0o644) //nolint:gomnd // file permissions
file, err := c.hostFs.OpenFile(c.configPath, os.O_APPEND|os.O_WRONLY, 0o644) //nolint:mnd // file permissions
if err != nil {
return err
}
Expand Down Expand Up @@ -101,7 +101,7 @@ func (c *Config) RemoveRuntime(shimPath string) (changed bool, err error) {
modifiedData := strings.ReplaceAll(string(data), cfg, "")

// Write the modified data back to the file.
err = afero.WriteFile(c.hostFs, c.configPath, []byte(modifiedData), 0o644) //nolint:gomnd // file permissions
err = afero.WriteFile(c.hostFs, c.configPath, []byte(modifiedData), 0o644) //nolint:mnd // file permissions
if err != nil {
return false, err
}
Expand Down
5 changes: 3 additions & 2 deletions internal/controller/shim_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const (
UNINSTALL = "uninstall"
ProvisioningStatusProvisioned = "provisioned"
ProvisioningStatusPending = "pending"
K8sNameMaxLength = 63
)

// ShimReconciler reconciles a Shim object
Expand Down Expand Up @@ -385,7 +386,7 @@ func (sr *ShimReconciler) createJobManifest(shim *rcmv1.Shim, node *corev1.Node,
sr.setOperationConfiguration(shim, &opConfig)

name := node.Name + "-" + shim.Name + "-" + operation
nameMax := int(math.Min(float64(len(name)), 63))
nameMax := int(math.Min(float64(len(name)), K8sNameMaxLength))

job := &batchv1.Job{
TypeMeta: metav1.TypeMeta{
Expand Down Expand Up @@ -498,7 +499,7 @@ func (sr *ShimReconciler) handleDeployRuntimeClass(ctx context.Context, shim *rc
// createRuntimeClassManifest creates a RuntimeClass manifest for a Shim.
func (sr *ShimReconciler) createRuntimeClassManifest(shim *rcmv1.Shim) (*nodev1.RuntimeClass, error) {
name := shim.Spec.RuntimeClass.Name
nameMax := int(math.Min(float64(len(name)), 63))
nameMax := int(math.Min(float64(len(name)), K8sNameMaxLength))

nodeSelector := shim.Spec.NodeSelector
if nodeSelector == nil {
Expand Down
6 changes: 3 additions & 3 deletions internal/shim/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ import (

func (c *Config) Install(shimName string) (filePath string, changed bool, err error) {
shimPath := filepath.Join(c.assetPath, shimName)
srcFile, err := c.rootFs.OpenFile(shimPath, os.O_RDONLY, 0o000) //nolint:gomnd // file permissions
srcFile, err := c.rootFs.OpenFile(shimPath, os.O_RDONLY, 0o000) //nolint:mnd // file permissions
if err != nil {
return "", false, err
}
dstFilePath := path.Join(c.kwasmPath, "bin", shimName)

err = c.hostFs.MkdirAll(path.Dir(dstFilePath), 0o775) //nolint:gomnd // file permissions
err = c.hostFs.MkdirAll(path.Dir(dstFilePath), 0o775) //nolint:mnd // file permissions
if err != nil {
return dstFilePath, false, err
}

dstFile, err := c.hostFs.OpenFile(dstFilePath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0o755) //nolint:gomnd // file permissions
dstFile, err := c.hostFs.OpenFile(dstFilePath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0o755) //nolint:mnd // file permissions
if err != nil {
return "", false, err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,5 @@ func (l *State) Write() error {

slog.Debug("writing lock file", "content", string(out))

return afero.WriteFile(l.fs, l.lockFilePath, out, 0644) //nolint:gomnd // file permissions
return afero.WriteFile(l.fs, l.lockFilePath, out, 0644) //nolint:mnd // file permissions
}
2 changes: 1 addition & 1 deletion tests/node-installer/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func FixtureFs(fixturePath string) afero.Fs {
return err
}
if info.IsDir() {
return fs.MkdirAll(path, 0755) //nolint:gomnd // file permissions
return fs.MkdirAll(path, 0755) //nolint:mnd // file permissions
}
src, err := baseFs.Open(path)
if err != nil {
Expand Down

0 comments on commit f57e58d

Please sign in to comment.