Skip to content

Commit

Permalink
fix: Fix linter deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
amhn committed Nov 18, 2022
1 parent 2042ef6 commit 47c6ddd
Show file tree
Hide file tree
Showing 105 changed files with 677 additions and 114 deletions.
15 changes: 6 additions & 9 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -256,18 +256,15 @@ output:

linters:
enable:
- deadcode
- unused
- gocyclo
- golint
- varcheck
- structcheck
- maligned
- revive
- errcheck
- ineffassign
- interfacer
- unconvert
- goconst
- gosec
- govet
- megacheck
#disable:
# - maligned
Expand Down Expand Up @@ -310,9 +307,9 @@ issues:
# text: "SA9003:"

# Exclude lll issues for long lines with go:generate
- linters:
- errcheck
text: "Error return value of `d.Set` is not checked"
# - linters:
# - errcheck
# text: "Error return value of `d.Set` is not checked"
# source: "^//go:generate "

# Independently from option `exclude` we use default exclude patterns,
Expand Down
4 changes: 3 additions & 1 deletion netbox/dcim/data_netbox_dcim_platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ func dataNetboxDcimPlatformRead(ctx context.Context, d *schema.ResourceData, m i

r := list.Payload.Results[0]
d.SetId(strconv.FormatInt(r.ID, 10))
d.Set("content_type", util.ConvertURIContentType(r.URL))
if err = d.Set("content_type", util.ConvertURIContentType(r.URL)); err != nil {
return diag.FromErr(err)
}

return nil
}
4 changes: 3 additions & 1 deletion netbox/dcim/data_netbox_dcim_site.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ func dataNetboxDcimSiteRead(ctx context.Context, d *schema.ResourceData, m inter

r := list.Payload.Results[0]
d.SetId(strconv.FormatInt(r.ID, 10))
d.Set("content_type", util.ConvertURIContentType(r.URL))
if err = d.Set("content_type", util.ConvertURIContentType(r.URL)); err != nil {
return diag.FromErr(err)
}

return nil
}
4 changes: 3 additions & 1 deletion netbox/ipam/data_netbox_ipam_aggregate.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ func dataNetboxIpamAggregateRead(ctx context.Context, d *schema.ResourceData,

r := list.Payload.Results[0]
d.SetId(strconv.FormatInt(r.ID, 10))
d.Set("content_type", util.ConvertURIContentType(r.URL))
if err = d.Set("content_type", util.ConvertURIContentType(r.URL)); err != nil {
return diag.FromErr(err)
}

return nil
}
4 changes: 3 additions & 1 deletion netbox/ipam/data_netbox_ipam_ip_addresses.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ func dataNetboxIpamIPAddressesRead(ctx context.Context, d *schema.ResourceData,

r := list.Payload.Results[0]
d.SetId(strconv.FormatInt(r.ID, 10))
d.Set("content_type", util.ConvertURIContentType(r.URL))
if err = d.Set("content_type", util.ConvertURIContentType(r.URL)); err != nil {
return diag.FromErr(err)
}

return nil
}
4 changes: 3 additions & 1 deletion netbox/ipam/data_netbox_ipam_role.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ func dataNetboxIpamRoleRead(ctx context.Context, d *schema.ResourceData, m inter

r := list.Payload.Results[0]
d.SetId(strconv.FormatInt(r.ID, 10))
d.Set("content_type", util.ConvertURIContentType(r.URL))
if err = d.Set("content_type", util.ConvertURIContentType(r.URL)); err != nil {
return diag.FromErr(err)
}

return nil
}
4 changes: 3 additions & 1 deletion netbox/ipam/data_netbox_ipam_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ func dataNetboxIpamServiceRead(ctx context.Context, d *schema.ResourceData,

r := list.Payload.Results[0]
d.SetId(strconv.FormatInt(r.ID, 10))
d.Set("content_type", util.ConvertURIContentType(r.URL))
if err = d.Set("content_type", util.ConvertURIContentType(r.URL)); err != nil {
return diag.FromErr(err)
}

return nil
}
4 changes: 3 additions & 1 deletion netbox/ipam/data_netbox_ipam_vlan.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ func dataNetboxIpamVlanRead(ctx context.Context, d *schema.ResourceData, m inter

r := list.Payload.Results[0]
d.SetId(strconv.FormatInt(r.ID, 10))
d.Set("content_type", util.ConvertURIContentType(r.URL))
if err = d.Set("content_type", util.ConvertURIContentType(r.URL)); err != nil {
return diag.FromErr(err)
}

return nil
}
4 changes: 3 additions & 1 deletion netbox/ipam/data_netbox_ipam_vlan_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ func dataNetboxIpamVlanGroupRead(ctx context.Context, d *schema.ResourceData, m

r := list.Payload.Results[0]
d.SetId(strconv.FormatInt(r.ID, 10))
d.Set("content_type", util.ConvertURIContentType(r.URL))
if err = d.Set("content_type", util.ConvertURIContentType(r.URL)); err != nil {
return diag.FromErr(err)
}

return nil
}
8 changes: 6 additions & 2 deletions netbox/ipam/resource_netbox_ipam_ip_addresses.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,19 @@ func resourceNetboxIpamIPAddressesCreate(ctx context.Context, d *schema.Resource
}
address = *ip.Address
addressid = &ip.ID
d.Set("address", address)
if err := d.Set("address", address); err != nil {
return diag.FromErr(err)
}
} else if rangeid, ok := d.GetOk("ip_range"); ok {
ip, err := getNewAvailableIPForIPRange(client, int64(rangeid.(int)))
if err != nil {
return diag.FromErr(err)
}
address = *ip.Address
addressid = &ip.ID
d.Set("address", address)
if err := d.Set("address", address); err != nil {
return diag.FromErr(err)
}
} else {
return diag.Errorf("exactly one of (address, ip_range, prefix) must be specified")
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion netbox/json/data_netbox_json_circuits_circuit_types_list.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion netbox/json/data_netbox_json_circuits_circuits_list.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion netbox/json/data_netbox_json_circuits_providers_list.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion netbox/json/data_netbox_json_dcim_cables_list.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion netbox/json/data_netbox_json_dcim_console_ports_list.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 47c6ddd

Please sign in to comment.