Skip to content

Commit a73b8d2

Browse files
authored
fix linter error (#4039)
1 parent ba8ea2e commit a73b8d2

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

internal/core/error.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func (s *CliError) MarshalHuman() (string, error) {
4343
if s.Err != nil {
4444
humanError := s.Err
4545
if s.Message != "" {
46-
humanError = fmt.Errorf(s.Message)
46+
humanError = fmt.Errorf("%s", s.Message)
4747
}
4848
str, err := human.Marshal(humanError, nil)
4949
if err != nil {

internal/namespaces/baremetal/v1/helpers_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ func createServer(metaKey string) core.BeforeFunc {
2525
//
2626
//nolint:unparam
2727
func deleteServer(metaKey string) core.AfterFunc {
28-
return core.ExecAfterCmd(fmt.Sprintf("scw baremetal server delete zone=nl-ams-1 {{ ." + metaKey + ".ID }}"))
28+
return core.ExecAfterCmd(fmt.Sprintf("scw baremetal server delete zone=nl-ams-1 {{ .%s.ID }}", metaKey))
2929
}
3030

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

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

4545
// delete an ssh key with a given meta key
4646
func deleteSSH(metaKey string) core.AfterFunc {
47-
return core.ExecAfterCmd(fmt.Sprintf("scw iam ssh-key delete {{ ." + metaKey + ".ID }}"))
47+
return core.ExecAfterCmd(fmt.Sprintf("scw iam ssh-key delete {{ .%s.ID }}", metaKey))
4848
}

internal/namespaces/iam/v1alpha1/error.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func installationCanceled(addKeyInstructions string) *core.CliError {
1515

1616
func sshKeyNotFound(filename string, addKeyInstructions string) *core.CliError {
1717
return &core.CliError{
18-
Err: fmt.Errorf("could not find an SSH key at " + filename),
18+
Err: fmt.Errorf("could not find an SSH key at %s", filename),
1919
Hint: "You can add one later using " + addKeyInstructions,
2020
}
2121
}

internal/namespaces/instance/v1/custom_server_create.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -552,14 +552,14 @@ func validateLocalVolumeSizes(volumes map[string]*instance.VolumeServerTemplate,
552552
}
553553

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

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

565565
return nil

internal/namespaces/rdb/v1/custom_instance.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ func getPublicEndpoint(endpoints []*rdbSDK.Endpoint) (*rdbSDK.Endpoint, error) {
706706
}
707707
}
708708

709-
return nil, fmt.Errorf(errorMessagePublicEndpointNotFound)
709+
return nil, fmt.Errorf("%s", errorMessagePublicEndpointNotFound)
710710
}
711711

712712
func getPrivateEndpoint(endpoints []*rdbSDK.Endpoint) (*rdbSDK.Endpoint, error) {
@@ -716,7 +716,7 @@ func getPrivateEndpoint(endpoints []*rdbSDK.Endpoint) (*rdbSDK.Endpoint, error)
716716
}
717717
}
718718

719-
return nil, fmt.Errorf(errorMessagePrivateEndpointNotFound)
719+
return nil, fmt.Errorf("%s", errorMessagePrivateEndpointNotFound)
720720
}
721721

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

817817
if len(instance.Endpoints) == 0 {
818-
return nil, fmt.Errorf(errorMessageEndpointNotFound)
818+
return nil, fmt.Errorf("%s", errorMessageEndpointNotFound)
819819
}
820820

821821
var endpoint *rdbSDK.Endpoint

0 commit comments

Comments
 (0)