Skip to content

Commit

Permalink
Merge pull request #13013 from justinsb/staticcheck_cleanups_1
Browse files Browse the repository at this point in the history
staticcheck cleanup: fixup nodeup/pkg/model
  • Loading branch information
k8s-ci-robot authored Dec 20, 2021
2 parents f25e760 + 8d7f448 commit 47c7f21
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions nodeup/pkg/model/cloudconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func TestBuildAzure(t *testing.T) {
}
}
if task == nil {
t.Errorf("no File task found")
t.Fatalf("no File task found")
}
r, err := task.Contents.Open()
if err != nil {
Expand Down Expand Up @@ -150,7 +150,7 @@ func TestBuildAWSCustomNodeIPFamilies(t *testing.T) {
}
}
if task == nil {
t.Errorf("no File task found")
t.Fatalf("no File task found")
}
r, err := task.Contents.Open()
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions nodeup/pkg/model/sysctls.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func (b *SysctlBuilder) Build(c *fi.ModelBuilderContext) error {
"")
for _, param := range params {
if !strings.ContainsRune(param, '=') {
return fmt.Errorf("Invalid SysctlParameter: expected %q to contain '='", param)
return fmt.Errorf("invalid SysctlParameter: expected %q to contain '='", param)
}
sysctls = append(sysctls, param)
}
Expand All @@ -181,7 +181,7 @@ func (b *SysctlBuilder) Build(c *fi.ModelBuilderContext) error {
"")
for _, param := range params {
if !strings.ContainsRune(param, '=') {
return fmt.Errorf("Invalid SysctlParameter: expected %q to contain '='", param)
return fmt.Errorf("invalid SysctlParameter: expected %q to contain '='", param)
}
sysctls = append(sysctls, param)
}
Expand Down
4 changes: 2 additions & 2 deletions nodeup/pkg/model/volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (b *VolumesBuilder) Build(c *fi.ModelBuilderContext) error {
for _, x := range b.NodeupConfig.VolumeMounts {
// @check the directory exists, else create it
if err := b.EnsureDirectory(x.Path); err != nil {
return fmt.Errorf("failed to ensure the directory: %s, error: %s", x.Path, err)
return fmt.Errorf("failed to ensure the directory: %s, error: %w", x.Path, err)
}

m := &mount.SafeFormatAndMount{
Expand All @@ -56,7 +56,7 @@ func (b *VolumesBuilder) Build(c *fi.ModelBuilderContext) error {

// @check if the device is already mounted
if found, err := b.IsMounted(m, x.Device, x.Path); err != nil {
return fmt.Errorf("Failed to check if device: %s is mounted, error: %s", x.Device, err)
return fmt.Errorf("failed to check if device %q is mounted, error: %w", x.Device, err)
} else if found {
klog.V(3).Infof("Skipping device: %s, path: %s as already mounted", x.Device, x.Path)
continue
Expand Down

0 comments on commit 47c7f21

Please sign in to comment.