Skip to content

Commit

Permalink
Make diag errors use constant format strings (#512)
Browse files Browse the repository at this point in the history
  • Loading branch information
optik-aper authored Oct 16, 2024
1 parent 46809d7 commit eef6a7c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion vultr/data_source_vultr_bare_metal_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ func dataSourceVultrBareMetalServerRead(ctx context.Context, d *schema.ResourceD

vpc2s, err := getBareMetalServerVPC2s(client, d.Id())
if err != nil {
return diag.Errorf(err.Error())
return diag.Errorf("%s", err.Error())
}

if err := d.Set("vpc2_ids", vpc2s); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions vultr/data_source_vultr_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,12 +300,12 @@ func dataSourceVultrInstanceRead(ctx context.Context, d *schema.ResourceData, me

vpcs, err := getVPCs(client, d.Id())
if err != nil {
return diag.Errorf(err.Error())
return diag.Errorf("%s", err.Error())
}

vpc2s, err := getVPC2s(client, d.Id())
if err != nil {
return diag.Errorf(err.Error())
return diag.Errorf("%s", err.Error())
}

if err := d.Set("vpc_ids", vpcs); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion vultr/data_source_vultr_instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func dataSourceVultrInstancesRead(ctx context.Context, d *schema.ResourceData, m

vpcs, err := getVPCs(client, server.ID)
if err != nil {
return diag.Errorf(err.Error())
return diag.Errorf("%s", err.Error())
}

serverList = append(serverList, map[string]interface{}{
Expand Down
2 changes: 1 addition & 1 deletion vultr/resource_vultr_bare_metal_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ func resourceVultrBareMetalServerRead(ctx context.Context, d *schema.ResourceDat

vpc2s, err := getBareMetalServerVPC2s(client, d.Id())
if err != nil {
return diag.Errorf(err.Error())
return diag.Errorf("%s", err.Error())
}

if _, vpcUpdate := d.GetOk("vpc2_ids"); vpcUpdate {
Expand Down
6 changes: 3 additions & 3 deletions vultr/resource_vultr_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ func resourceVultrInstanceCreate(ctx context.Context, d *schema.ResourceData, me
if osOption == "" && osID.(int) != 0 {
osOption = "os_id"
} else if osOption != "" && osID.(int) != 0 {
return diag.Errorf(fmt.Sprintf("Please do not set %s with os_id", osOption))
return diag.Errorf("Please do not set %s with os_id", osOption)
}

switch osOption {
Expand Down Expand Up @@ -544,12 +544,12 @@ func resourceVultrInstanceRead(ctx context.Context, d *schema.ResourceData, meta

vpcs, err := getVPCs(client, d.Id())
if err != nil {
return diag.Errorf(err.Error())
return diag.Errorf("%s", err.Error())
}

vpc2s, err := getVPC2s(client, d.Id())
if err != nil {
return diag.Errorf(err.Error())
return diag.Errorf("%s", err.Error())
}

if _, vpcUpdate := d.GetOk("vpc_ids"); vpcUpdate {
Expand Down

0 comments on commit eef6a7c

Please sign in to comment.