Skip to content

Commit

Permalink
check for err as well
Browse files Browse the repository at this point in the history
  • Loading branch information
phm07 committed Dec 20, 2024
1 parent 00967bc commit 8f35cd3
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion hcloud/certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func (c *CertificateClient) GetByName(ctx context.Context, name string) (*Certif
func (c *CertificateClient) Get(ctx context.Context, idOrName string) (*Certificate, *Response, error) {
if id, err := strconv.ParseInt(idOrName, 10, 64); err == nil {
cert, res, err := c.GetByID(ctx, id)
if cert != nil {
if cert != nil || err != nil {
return cert, res, err
}
}
Expand Down
2 changes: 1 addition & 1 deletion hcloud/firewall.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func (c *FirewallClient) GetByName(ctx context.Context, name string) (*Firewall,
func (c *FirewallClient) Get(ctx context.Context, idOrName string) (*Firewall, *Response, error) {
if id, err := strconv.ParseInt(idOrName, 10, 64); err == nil {
fw, res, err := c.GetByID(ctx, id)
if fw != nil {
if fw != nil || err != nil {
return fw, res, err
}
}
Expand Down
2 changes: 1 addition & 1 deletion hcloud/floating_ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func (c *FloatingIPClient) GetByName(ctx context.Context, name string) (*Floatin
func (c *FloatingIPClient) Get(ctx context.Context, idOrName string) (*FloatingIP, *Response, error) {
if id, err := strconv.ParseInt(idOrName, 10, 64); err == nil {
ip, res, err := c.GetByID(ctx, id)
if ip != nil {
if ip != nil || err != nil {
return ip, res, err
}
}
Expand Down
2 changes: 1 addition & 1 deletion hcloud/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func (c *ImageClient) Get(ctx context.Context, idOrName string) (*Image, *Respon
func (c *ImageClient) GetForArchitecture(ctx context.Context, idOrName string, architecture Architecture) (*Image, *Response, error) {
if id, err := strconv.ParseInt(idOrName, 10, 64); err == nil {
img, res, err := c.GetByID(ctx, id)
if img != nil {
if img != nil || err != nil {
return img, res, err
}
}
Expand Down
2 changes: 1 addition & 1 deletion hcloud/load_balancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ func (c *LoadBalancerClient) GetByName(ctx context.Context, name string) (*LoadB
func (c *LoadBalancerClient) Get(ctx context.Context, idOrName string) (*LoadBalancer, *Response, error) {
if id, err := strconv.ParseInt(idOrName, 10, 64); err == nil {
lb, res, err := c.GetByID(ctx, id)
if lb != nil {
if lb != nil || err != nil {
return lb, res, err
}
}
Expand Down
2 changes: 1 addition & 1 deletion hcloud/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (c *NetworkClient) GetByName(ctx context.Context, name string) (*Network, *
func (c *NetworkClient) Get(ctx context.Context, idOrName string) (*Network, *Response, error) {
if id, err := strconv.ParseInt(idOrName, 10, 64); err == nil {
n, res, err := c.GetByID(ctx, id)
if n != nil {
if n != nil || err != nil {
return n, res, err
}
}
Expand Down
2 changes: 1 addition & 1 deletion hcloud/placement_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (c *PlacementGroupClient) GetByName(ctx context.Context, name string) (*Pla
func (c *PlacementGroupClient) Get(ctx context.Context, idOrName string) (*PlacementGroup, *Response, error) {
if id, err := strconv.ParseInt(idOrName, 10, 64); err == nil {
pg, res, err := c.GetByID(ctx, id)
if pg != nil {
if pg != nil || err != nil {
return pg, res, err
}
}
Expand Down
2 changes: 1 addition & 1 deletion hcloud/primary_ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func (c *PrimaryIPClient) GetByName(ctx context.Context, name string) (*PrimaryI
func (c *PrimaryIPClient) Get(ctx context.Context, idOrName string) (*PrimaryIP, *Response, error) {
if id, err := strconv.ParseInt(idOrName, 10, 64); err == nil {
ip, res, err := c.GetByID(ctx, id)
if ip != nil {
if ip != nil || err != nil {
return ip, res, err
}
}
Expand Down
2 changes: 1 addition & 1 deletion hcloud/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ func (c *ServerClient) GetByName(ctx context.Context, name string) (*Server, *Re
func (c *ServerClient) Get(ctx context.Context, idOrName string) (*Server, *Response, error) {
if id, err := strconv.ParseInt(idOrName, 10, 64); err == nil {
srv, res, err := c.GetByID(ctx, id)
if srv != nil {
if srv != nil || err != nil {
return srv, res, err
}
}
Expand Down
2 changes: 1 addition & 1 deletion hcloud/ssh_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (c *SSHKeyClient) GetByFingerprint(ctx context.Context, fingerprint string)
func (c *SSHKeyClient) Get(ctx context.Context, idOrName string) (*SSHKey, *Response, error) {
if id, err := strconv.ParseInt(idOrName, 10, 64); err == nil {
sshKey, res, err := c.GetByID(ctx, id)
if sshKey != nil {
if sshKey != nil || err != nil {
return sshKey, res, err
}
}
Expand Down
2 changes: 1 addition & 1 deletion hcloud/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (c *VolumeClient) GetByName(ctx context.Context, name string) (*Volume, *Re
func (c *VolumeClient) Get(ctx context.Context, idOrName string) (*Volume, *Response, error) {
if id, err := strconv.ParseInt(idOrName, 10, 64); err == nil {
vol, res, err := c.GetByID(ctx, id)
if vol != nil {
if vol != nil || err != nil {
return vol, res, err
}
}
Expand Down

0 comments on commit 8f35cd3

Please sign in to comment.