Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix linter error #4039

Merged
merged 1 commit into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/core/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (s *CliError) MarshalHuman() (string, error) {
if s.Err != nil {
humanError := s.Err
if s.Message != "" {
humanError = fmt.Errorf(s.Message)
humanError = fmt.Errorf("%s", s.Message)
}
str, err := human.Marshal(humanError, nil)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions internal/namespaces/baremetal/v1/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ func createServer(metaKey string) core.BeforeFunc {
//
//nolint:unparam
func deleteServer(metaKey string) core.AfterFunc {
return core.ExecAfterCmd(fmt.Sprintf("scw baremetal server delete zone=nl-ams-1 {{ ." + metaKey + ".ID }}"))
return core.ExecAfterCmd(fmt.Sprintf("scw baremetal server delete zone=nl-ams-1 {{ .%s.ID }}", metaKey))
}

func deleteServerDefault(metaKey string) core.AfterFunc {
return core.ExecAfterCmd(fmt.Sprintf("scw baremetal server delete {{ ." + metaKey + ".ID }}"))
return core.ExecAfterCmd(fmt.Sprintf("scw baremetal server delete {{ .%s.ID }}", metaKey))
}

// add an ssh key with a given meta key
Expand All @@ -44,5 +44,5 @@ func addSSH(metaKey string, key string) core.BeforeFunc {

// delete an ssh key with a given meta key
func deleteSSH(metaKey string) core.AfterFunc {
return core.ExecAfterCmd(fmt.Sprintf("scw iam ssh-key delete {{ ." + metaKey + ".ID }}"))
return core.ExecAfterCmd(fmt.Sprintf("scw iam ssh-key delete {{ .%s.ID }}", metaKey))
}
2 changes: 1 addition & 1 deletion internal/namespaces/iam/v1alpha1/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func installationCanceled(addKeyInstructions string) *core.CliError {

func sshKeyNotFound(filename string, addKeyInstructions string) *core.CliError {
return &core.CliError{
Err: fmt.Errorf("could not find an SSH key at " + filename),
Err: fmt.Errorf("could not find an SSH key at %s", filename),
Hint: "You can add one later using " + addKeyInstructions,
}
}
8 changes: 4 additions & 4 deletions internal/namespaces/instance/v1/custom_server_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -552,14 +552,14 @@ func validateLocalVolumeSizes(volumes map[string]*instance.VolumeServerTemplate,
}

if localVolumeTotalSize < volumeConstraint.MinSize || localVolumeTotalSize > volumeConstraint.MaxSize {
min := humanize.Bytes(uint64(volumeConstraint.MinSize))
minSize := humanize.Bytes(uint64(volumeConstraint.MinSize))
computedLocal := humanize.Bytes(uint64(localVolumeTotalSize))
if volumeConstraint.MinSize == volumeConstraint.MaxSize {
return fmt.Errorf("%s total local volume size must be equal to %s, got %s", commercialType, min, computedLocal)
return fmt.Errorf("%s total local volume size must be equal to %s, got %s", commercialType, minSize, computedLocal)
}

max := humanize.Bytes(uint64(volumeConstraint.MaxSize))
return fmt.Errorf("%s total local volume size must be between %s and %s, got %s", commercialType, min, max, computedLocal)
maxSize := humanize.Bytes(uint64(volumeConstraint.MaxSize))
return fmt.Errorf("%s total local volume size must be between %s and %s, got %s", commercialType, minSize, maxSize, computedLocal)
}

return nil
Expand Down
6 changes: 3 additions & 3 deletions internal/namespaces/rdb/v1/custom_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ func getPublicEndpoint(endpoints []*rdbSDK.Endpoint) (*rdbSDK.Endpoint, error) {
}
}

return nil, fmt.Errorf(errorMessagePublicEndpointNotFound)
return nil, fmt.Errorf("%s", errorMessagePublicEndpointNotFound)
}

func getPrivateEndpoint(endpoints []*rdbSDK.Endpoint) (*rdbSDK.Endpoint, error) {
Expand All @@ -716,7 +716,7 @@ func getPrivateEndpoint(endpoints []*rdbSDK.Endpoint) (*rdbSDK.Endpoint, error)
}
}

return nil, fmt.Errorf(errorMessagePrivateEndpointNotFound)
return nil, fmt.Errorf("%s", errorMessagePrivateEndpointNotFound)
}

func createConnectCommandLineArgs(endpoint *rdbSDK.Endpoint, family engineFamily, args *instanceConnectArgs) ([]string, error) {
Expand Down Expand Up @@ -815,7 +815,7 @@ func instanceConnectCommand() *core.Command {
}

if len(instance.Endpoints) == 0 {
return nil, fmt.Errorf(errorMessageEndpointNotFound)
return nil, fmt.Errorf("%s", errorMessageEndpointNotFound)
}

var endpoint *rdbSDK.Endpoint
Expand Down
Loading