diff --git a/go.mod b/go.mod index 8e84a9c1a..8abfd56a8 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/hetznercloud/cli -go 1.25.0 +go 1.26.0 toolchain go1.27.1 diff --git a/internal/cmd/all/list_test.go b/internal/cmd/all/list_test.go index 84b1123a1..43acc3ae6 100644 --- a/internal/cmd/all/list_test.go +++ b/internal/cmd/all/list_test.go @@ -203,7 +203,7 @@ func TestListAll(t *testing.T) { Minute: 1, Hour: 2, DayOfWeek: hcloud.Ptr(time.Sunday), - DayOfMonth: hcloud.Ptr(4), + DayOfMonth: new(4), }, Created: time.Now().Add(-3 * time.Hour), }, @@ -381,7 +381,7 @@ func TestListAllPaidJSON(t *testing.T) { Minute: 1, Hour: 2, DayOfWeek: hcloud.Ptr(time.Sunday), - DayOfMonth: hcloud.Ptr(4), + DayOfMonth: new(4), }, Created: time.Date(2024, 4, 2, 10, 0, 0, 0, time.UTC), }, diff --git a/internal/cmd/firewall/add_rule.go b/internal/cmd/firewall/add_rule.go index e7224fc05..13b03b351 100644 --- a/internal/cmd/firewall/add_rule.go +++ b/internal/cmd/firewall/add_rule.go @@ -101,11 +101,11 @@ func parseRuleFromArgs(flags *pflag.FlagSet) (*hcloud.FirewallRule, error) { } if port != "" { - rule.Port = hcloud.Ptr(port) + rule.Port = new(port) } if description != "" { - rule.Description = hcloud.Ptr(description) + rule.Description = new(description) } switch rule.Protocol { diff --git a/internal/cmd/firewall/add_rule_test.go b/internal/cmd/firewall/add_rule_test.go index 9a3316c01..6647ffb55 100644 --- a/internal/cmd/firewall/add_rule_test.go +++ b/internal/cmd/firewall/add_rule_test.go @@ -35,8 +35,8 @@ func TestAddRule(t *testing.T) { SourceIPs: []net.IPNet{{IP: net.IP{0, 0, 0, 0}, Mask: net.IPMask{0, 0, 0, 0}}, {IP: net.IP{127, 0, 0, 1}, Mask: net.IPMask{255, 255, 255, 255}}}, DestinationIPs: []net.IPNet{}, Protocol: hcloud.FirewallRuleProtocolTCP, - Port: hcloud.Ptr("80"), - Description: hcloud.Ptr("http"), + Port: new("80"), + Description: new("http"), }}, }). Return([]*hcloud.Action{{ID: 123}, {ID: 321}}, nil, nil) diff --git a/internal/cmd/firewall/create_test.go b/internal/cmd/firewall/create_test.go index 69848ba73..1aa2cf1c0 100644 --- a/internal/cmd/firewall/create_test.go +++ b/internal/cmd/firewall/create_test.go @@ -42,8 +42,8 @@ func TestCreate(t *testing.T) { }, DestinationIPs: nil, Protocol: hcloud.FirewallRuleProtocolTCP, - Port: hcloud.Ptr("80"), - Description: hcloud.Ptr("Allow port 80"), + Port: new("80"), + Description: new("Allow port 80"), }, { Direction: hcloud.FirewallRuleDirectionIn, @@ -56,8 +56,8 @@ func TestCreate(t *testing.T) { }, DestinationIPs: nil, Protocol: hcloud.FirewallRuleProtocolTCP, - Port: hcloud.Ptr("443"), - Description: hcloud.Ptr("Allow port 443"), + Port: new("443"), + Description: new("Allow port 443"), }, { Direction: hcloud.FirewallRuleDirectionOut, @@ -71,7 +71,7 @@ func TestCreate(t *testing.T) { }, }, Protocol: hcloud.FirewallRuleProtocolTCP, - Port: hcloud.Ptr("80"), + Port: new("80"), }, }, }). @@ -123,7 +123,7 @@ func TestCreateJSON(t *testing.T) { SourceIPs: []net.IPNet{}, DestinationIPs: []net.IPNet{}, Protocol: "tcp", - Port: hcloud.Ptr("22"), + Port: new("22"), }, }, }, diff --git a/internal/cmd/firewall/delete_rule_test.go b/internal/cmd/firewall/delete_rule_test.go index 66f1e785b..b70a5817d 100644 --- a/internal/cmd/firewall/delete_rule_test.go +++ b/internal/cmd/firewall/delete_rule_test.go @@ -28,8 +28,8 @@ func TestDeleteRule(t *testing.T) { SourceIPs: []net.IPNet{{IP: net.IP{0, 0, 0, 0}, Mask: net.IPMask{0, 0, 0, 0}}, {IP: net.IP{127, 0, 0, 1}, Mask: net.IPMask{255, 255, 255, 255}}}, DestinationIPs: []net.IPNet{}, Protocol: hcloud.FirewallRuleProtocolTCP, - Port: hcloud.Ptr("80"), - Description: hcloud.Ptr("http"), + Port: new("80"), + Description: new("http"), }}, } diff --git a/internal/cmd/firewall/describe_test.go b/internal/cmd/firewall/describe_test.go index 8fa845aa6..c7343eb11 100644 --- a/internal/cmd/firewall/describe_test.go +++ b/internal/cmd/firewall/describe_test.go @@ -31,8 +31,8 @@ func TestDescribe(t *testing.T) { Rules: []hcloud.FirewallRule{ { Direction: hcloud.FirewallRuleDirectionIn, - Description: hcloud.Ptr("ssh"), - Port: hcloud.Ptr("22"), + Description: new("ssh"), + Port: new("22"), Protocol: hcloud.FirewallRuleProtocolTCP, }, }, diff --git a/internal/cmd/firewall/list_test.go b/internal/cmd/firewall/list_test.go index beec944d1..d9ad5c203 100644 --- a/internal/cmd/firewall/list_test.go +++ b/internal/cmd/firewall/list_test.go @@ -100,7 +100,7 @@ func TestListJSON(t *testing.T) { }, DestinationIPs: []net.IPNet{}, Protocol: hcloud.FirewallRuleProtocolTCP, - Port: hcloud.Ptr("80"), + Port: new("80"), }, }, AppliedTo: []hcloud.FirewallResource{ diff --git a/internal/cmd/firewall/replace_rules_test.go b/internal/cmd/firewall/replace_rules_test.go index 1db8664f7..dc6a45d01 100644 --- a/internal/cmd/firewall/replace_rules_test.go +++ b/internal/cmd/firewall/replace_rules_test.go @@ -43,8 +43,8 @@ func TestReplaceRules(t *testing.T) { }, DestinationIPs: nil, Protocol: hcloud.FirewallRuleProtocolTCP, - Port: hcloud.Ptr("80"), - Description: hcloud.Ptr("Allow port 80"), + Port: new("80"), + Description: new("Allow port 80"), }, { Direction: hcloud.FirewallRuleDirectionIn, @@ -57,8 +57,8 @@ func TestReplaceRules(t *testing.T) { }, DestinationIPs: nil, Protocol: hcloud.FirewallRuleProtocolTCP, - Port: hcloud.Ptr("443"), - Description: hcloud.Ptr("Allow port 443"), + Port: new("443"), + Description: new("Allow port 443"), }, { Direction: hcloud.FirewallRuleDirectionOut, @@ -72,7 +72,7 @@ func TestReplaceRules(t *testing.T) { }, }, Protocol: hcloud.FirewallRuleProtocolTCP, - Port: hcloud.Ptr("80"), + Port: new("80"), }, }, }). diff --git a/internal/cmd/floatingip/change_protection_test.go b/internal/cmd/floatingip/change_protection_test.go index 97d99b525..c63f43c9f 100644 --- a/internal/cmd/floatingip/change_protection_test.go +++ b/internal/cmd/floatingip/change_protection_test.go @@ -24,7 +24,7 @@ func TestEnableProtection(t *testing.T) { Return(&hcloud.FloatingIP{ID: 123}, nil, nil) fx.Client.FloatingIPClient.EXPECT(). ChangeProtection(gomock.Any(), &hcloud.FloatingIP{ID: 123}, hcloud.FloatingIPChangeProtectionOpts{ - Delete: hcloud.Ptr(true), + Delete: new(true), }). Return(&hcloud.Action{ID: 123}, nil, nil) fx.ActionWaiter.EXPECT(). @@ -52,7 +52,7 @@ func TestDisableProtection(t *testing.T) { Return(&hcloud.FloatingIP{ID: 123}, nil, nil) fx.Client.FloatingIPClient.EXPECT(). ChangeProtection(gomock.Any(), &hcloud.FloatingIP{ID: 123}, hcloud.FloatingIPChangeProtectionOpts{ - Delete: hcloud.Ptr(false), + Delete: new(false), }). Return(&hcloud.Action{ID: 123}, nil, nil) fx.ActionWaiter.EXPECT(). diff --git a/internal/cmd/floatingip/create_test.go b/internal/cmd/floatingip/create_test.go index 865f80d5d..9b0ec5eb4 100644 --- a/internal/cmd/floatingip/create_test.go +++ b/internal/cmd/floatingip/create_test.go @@ -33,11 +33,11 @@ func TestCreate(t *testing.T) { fx.Client.FloatingIPClient.EXPECT(). Create(gomock.Any(), hcloud.FloatingIPCreateOpts{ - Name: hcloud.Ptr("myFloatingIP"), + Name: new("myFloatingIP"), Type: hcloud.FloatingIPTypeIPv4, HomeLocation: &hcloud.Location{Name: "fsn1"}, Labels: make(map[string]string), - Description: hcloud.Ptr(""), + Description: new(""), }). Return(hcloud.FloatingIPCreateResult{ FloatingIP: floatingIP, @@ -76,11 +76,11 @@ func TestCreateJSON(t *testing.T) { fx.Client.FloatingIPClient.EXPECT(). Create(gomock.Any(), hcloud.FloatingIPCreateOpts{ - Name: hcloud.Ptr("myFloatingIP"), + Name: new("myFloatingIP"), Type: hcloud.FloatingIPTypeIPv4, HomeLocation: &hcloud.Location{Name: "fsn1"}, Labels: make(map[string]string), - Description: hcloud.Ptr(""), + Description: new(""), }). Return(hcloud.FloatingIPCreateResult{ FloatingIP: floatingIP, @@ -115,11 +115,11 @@ func TestCreateProtection(t *testing.T) { fx.Client.FloatingIPClient.EXPECT(). Create(gomock.Any(), hcloud.FloatingIPCreateOpts{ - Name: hcloud.Ptr("myFloatingIP"), + Name: new("myFloatingIP"), Type: hcloud.FloatingIPTypeIPv4, HomeLocation: &hcloud.Location{Name: "fsn1"}, Labels: make(map[string]string), - Description: hcloud.Ptr(""), + Description: new(""), }). Return(hcloud.FloatingIPCreateResult{ FloatingIP: floatingIP, @@ -131,7 +131,7 @@ func TestCreateProtection(t *testing.T) { fx.Client.FloatingIPClient.EXPECT(). ChangeProtection(gomock.Any(), floatingIP, hcloud.FloatingIPChangeProtectionOpts{ - Delete: hcloud.Ptr(true), + Delete: new(true), }). Return(&hcloud.Action{ID: 333}, nil, nil) fx.ActionWaiter.EXPECT().WaitForActions(gomock.Any(), gomock.Any(), &hcloud.Action{ID: 333}).Return(nil) diff --git a/internal/cmd/floatingip/set_rdns_test.go b/internal/cmd/floatingip/set_rdns_test.go index 8449eb66d..a004df787 100644 --- a/internal/cmd/floatingip/set_rdns_test.go +++ b/internal/cmd/floatingip/set_rdns_test.go @@ -29,7 +29,7 @@ func TestSetRDNS(t *testing.T) { Get(gomock.Any(), "test"). Return(floatingIP, nil, nil) fx.Client.RDNSClient.EXPECT(). - ChangeDNSPtr(gomock.Any(), floatingIP, floatingIP.IP, hcloud.Ptr("example.com")). + ChangeDNSPtr(gomock.Any(), floatingIP, floatingIP.IP, new("example.com")). Return(&hcloud.Action{ID: 123}, nil, nil) fx.ActionWaiter.EXPECT(). WaitForActions(gomock.Any(), gomock.Any(), &hcloud.Action{ID: 123}). diff --git a/internal/cmd/image/change_protection_test.go b/internal/cmd/image/change_protection_test.go index 3c3532978..cdb13da63 100644 --- a/internal/cmd/image/change_protection_test.go +++ b/internal/cmd/image/change_protection_test.go @@ -21,7 +21,7 @@ func TestEnableProtection(t *testing.T) { fx.Client.ImageClient.EXPECT(). ChangeProtection(gomock.Any(), &hcloud.Image{ID: 123}, hcloud.ImageChangeProtectionOpts{ - Delete: hcloud.Ptr(true), + Delete: new(true), }). Return(&hcloud.Action{ID: 123}, nil, nil) fx.ActionWaiter.EXPECT(). @@ -46,7 +46,7 @@ func TestDisableProtection(t *testing.T) { fx.Client.ImageClient.EXPECT(). ChangeProtection(gomock.Any(), &hcloud.Image{ID: 123}, hcloud.ImageChangeProtectionOpts{ - Delete: hcloud.Ptr(false), + Delete: new(false), }). Return(&hcloud.Action{ID: 123}, nil, nil) fx.ActionWaiter.EXPECT(). diff --git a/internal/cmd/image/update.go b/internal/cmd/image/update.go index c0b40d30d..b72aefaf2 100644 --- a/internal/cmd/image/update.go +++ b/internal/cmd/image/update.go @@ -32,7 +32,7 @@ var UpdateCmd = base.UpdateCmd[*hcloud.Image]{ }, Update: func(s state.State, _ *cobra.Command, image *hcloud.Image, flags map[string]pflag.Value) error { updOpts := hcloud.ImageUpdateOpts{ - Description: hcloud.Ptr(flags["description"].String()), + Description: new(flags["description"].String()), Type: hcloud.ImageType(flags["type"].String()), } _, _, err := s.Client().Image().Update(s, image, updOpts) diff --git a/internal/cmd/image/update_test.go b/internal/cmd/image/update_test.go index 18f4f0c97..bd02de5d6 100644 --- a/internal/cmd/image/update_test.go +++ b/internal/cmd/image/update_test.go @@ -24,7 +24,7 @@ func TestUpdateDescription(t *testing.T) { Return(&hcloud.Image{ID: 123}, nil, nil) fx.Client.ImageClient.EXPECT(). Update(gomock.Any(), &hcloud.Image{ID: 123}, hcloud.ImageUpdateOpts{ - Description: hcloud.Ptr("new-description"), + Description: new("new-description"), }) out, errOut, err := fx.Run(cmd, []string{"123", "--description", "new-description"}) @@ -48,7 +48,7 @@ func TestUpdateType(t *testing.T) { Return(&hcloud.Image{ID: 123}, nil, nil) fx.Client.ImageClient.EXPECT(). Update(gomock.Any(), &hcloud.Image{ID: 123}, hcloud.ImageUpdateOpts{ - Description: hcloud.Ptr(""), + Description: new(""), Type: hcloud.ImageTypeSnapshot, }) diff --git a/internal/cmd/loadbalancer/add_service_test.go b/internal/cmd/loadbalancer/add_service_test.go index b5ece7c22..7a880b5f5 100644 --- a/internal/cmd/loadbalancer/add_service_test.go +++ b/internal/cmd/loadbalancer/add_service_test.go @@ -26,14 +26,14 @@ func TestAddService(t *testing.T) { fx.Client.LoadBalancerClient.EXPECT(). AddService(gomock.Any(), &hcloud.LoadBalancer{ID: 123}, hcloud.LoadBalancerAddServiceOpts{ Protocol: hcloud.LoadBalancerServiceProtocolHTTP, - ListenPort: hcloud.Ptr(80), - DestinationPort: hcloud.Ptr(8080), + ListenPort: new(80), + DestinationPort: new(8080), HTTP: &hcloud.LoadBalancerAddServiceOptsHTTP{ - StickySessions: hcloud.Ptr(false), - RedirectHTTP: hcloud.Ptr(false), + StickySessions: new(false), + RedirectHTTP: new(false), TimeoutIdle: hcloud.Ptr(60 * time.Second), }, - Proxyprotocol: hcloud.Ptr(false), + Proxyprotocol: new(false), }). Return(&hcloud.Action{ID: 123}, nil, nil) fx.ActionWaiter.EXPECT(). @@ -65,28 +65,28 @@ func TestAddServiceWithHealthCheck(t *testing.T) { fx.Client.LoadBalancerClient.EXPECT(). AddService(gomock.Any(), &hcloud.LoadBalancer{ID: 123}, hcloud.LoadBalancerAddServiceOpts{ Protocol: hcloud.LoadBalancerServiceProtocolHTTP, - ListenPort: hcloud.Ptr(80), - DestinationPort: hcloud.Ptr(8080), + ListenPort: new(80), + DestinationPort: new(8080), HTTP: &hcloud.LoadBalancerAddServiceOptsHTTP{ - StickySessions: hcloud.Ptr(true), - RedirectHTTP: hcloud.Ptr(true), - CookieName: hcloud.Ptr("test"), + StickySessions: new(true), + RedirectHTTP: new(true), + CookieName: new("test"), Certificates: []*hcloud.Certificate{{ID: 1}}, CookieLifetime: hcloud.Ptr(10 * time.Minute), }, - Proxyprotocol: hcloud.Ptr(false), + Proxyprotocol: new(false), HealthCheck: &hcloud.LoadBalancerAddServiceOptsHealthCheck{ Protocol: hcloud.LoadBalancerServiceProtocolHTTP, - Port: hcloud.Ptr(80), + Port: new(80), Interval: hcloud.Ptr(10 * time.Second), Timeout: hcloud.Ptr(5 * time.Second), - Retries: hcloud.Ptr(2), + Retries: new(2), HTTP: &hcloud.LoadBalancerAddServiceOptsHealthCheckHTTP{ - Domain: hcloud.Ptr("example.com"), - Path: hcloud.Ptr("/health"), + Domain: new("example.com"), + Path: new("/health"), StatusCodes: []string{"200"}, - Response: hcloud.Ptr("OK"), - TLS: hcloud.Ptr(true), + Response: new("OK"), + TLS: new(true), }, }, }). diff --git a/internal/cmd/loadbalancer/add_target_test.go b/internal/cmd/loadbalancer/add_target_test.go index e0c8c5d3a..cb35e8a00 100644 --- a/internal/cmd/loadbalancer/add_target_test.go +++ b/internal/cmd/loadbalancer/add_target_test.go @@ -29,7 +29,7 @@ func TestAddTargetServer(t *testing.T) { fx.Client.LoadBalancerClient.EXPECT(). AddServerTarget(gomock.Any(), &hcloud.LoadBalancer{ID: 123}, hcloud.LoadBalancerAddServerTargetOpts{ Server: &hcloud.Server{ID: 321}, - UsePrivateIP: hcloud.Ptr(false), + UsePrivateIP: new(false), }). Return(&hcloud.Action{ID: 123}, nil, nil) fx.ActionWaiter.EXPECT(). @@ -58,7 +58,7 @@ func TestAddTargetLabelSelector(t *testing.T) { fx.Client.LoadBalancerClient.EXPECT(). AddLabelSelectorTarget(gomock.Any(), &hcloud.LoadBalancer{ID: 123}, hcloud.LoadBalancerAddLabelSelectorTargetOpts{ Selector: "my-label", - UsePrivateIP: hcloud.Ptr(false), + UsePrivateIP: new(false), }). Return(&hcloud.Action{ID: 123}, nil, nil) fx.ActionWaiter.EXPECT(). diff --git a/internal/cmd/loadbalancer/change_protection_test.go b/internal/cmd/loadbalancer/change_protection_test.go index 45213eb71..5bf9532a7 100644 --- a/internal/cmd/loadbalancer/change_protection_test.go +++ b/internal/cmd/loadbalancer/change_protection_test.go @@ -24,7 +24,7 @@ func TestEnableProtection(t *testing.T) { Return(&hcloud.LoadBalancer{ID: 123}, nil, nil) fx.Client.LoadBalancerClient.EXPECT(). ChangeProtection(gomock.Any(), &hcloud.LoadBalancer{ID: 123}, hcloud.LoadBalancerChangeProtectionOpts{ - Delete: hcloud.Ptr(true), + Delete: new(true), }). Return(&hcloud.Action{ID: 123}, nil, nil) fx.ActionWaiter.EXPECT(). @@ -52,7 +52,7 @@ func TestDisableProtection(t *testing.T) { Return(&hcloud.LoadBalancer{ID: 123}, nil, nil) fx.Client.LoadBalancerClient.EXPECT(). ChangeProtection(gomock.Any(), &hcloud.LoadBalancer{ID: 123}, hcloud.LoadBalancerChangeProtectionOpts{ - Delete: hcloud.Ptr(false), + Delete: new(false), }). Return(&hcloud.Action{ID: 123}, nil, nil) fx.ActionWaiter.EXPECT(). diff --git a/internal/cmd/loadbalancer/create_test.go b/internal/cmd/loadbalancer/create_test.go index 87396d054..4daa20a63 100644 --- a/internal/cmd/loadbalancer/create_test.go +++ b/internal/cmd/loadbalancer/create_test.go @@ -235,7 +235,7 @@ func TestCreateProtection(t *testing.T) { Return(loadBalancer, nil, nil) fx.Client.LoadBalancerClient.EXPECT(). ChangeProtection(gomock.Any(), loadBalancer, hcloud.LoadBalancerChangeProtectionOpts{ - Delete: hcloud.Ptr(true), + Delete: new(true), }). Return(&hcloud.Action{ID: 333}, nil, nil) fx.ActionWaiter.EXPECT().WaitForActions(gomock.Any(), gomock.Any(), &hcloud.Action{ID: 333}).Return(nil) diff --git a/internal/cmd/loadbalancer/describe_test.go b/internal/cmd/loadbalancer/describe_test.go index 5ed01fdf1..4f09267b6 100644 --- a/internal/cmd/loadbalancer/describe_test.go +++ b/internal/cmd/loadbalancer/describe_test.go @@ -96,7 +96,7 @@ func TestDescribe(t *testing.T) { ListenPort: 443, Status: hcloud.LoadBalancerTargetHealthStatusStatusUnhealthy, Detail: hcloud.Ptr(hcloud.LoadBalancerTargetHealthStatusDetailUnexpectedHTTPStatus), - HTTPStatusCode: hcloud.Ptr(500), + HTTPStatusCode: new(500), }, }, }, diff --git a/internal/cmd/loadbalancer/set_rdns_test.go b/internal/cmd/loadbalancer/set_rdns_test.go index 0911b2fcd..606636cea 100644 --- a/internal/cmd/loadbalancer/set_rdns_test.go +++ b/internal/cmd/loadbalancer/set_rdns_test.go @@ -33,7 +33,7 @@ func TestSetRDNS(t *testing.T) { Get(gomock.Any(), "test"). Return(loadBalancer, nil, nil) fx.Client.RDNSClient.EXPECT(). - ChangeDNSPtr(gomock.Any(), loadBalancer, loadBalancer.PublicNet.IPv4.IP, hcloud.Ptr("example.com")). + ChangeDNSPtr(gomock.Any(), loadBalancer, loadBalancer.PublicNet.IPv4.IP, new("example.com")). Return(&hcloud.Action{ID: 123}, nil, nil) fx.ActionWaiter.EXPECT(). WaitForActions(gomock.Any(), gomock.Any(), &hcloud.Action{ID: 123}). diff --git a/internal/cmd/loadbalancer/update_service_test.go b/internal/cmd/loadbalancer/update_service_test.go index f7254c7a0..588ee53d3 100644 --- a/internal/cmd/loadbalancer/update_service_test.go +++ b/internal/cmd/loadbalancer/update_service_test.go @@ -28,29 +28,29 @@ func TestUpdateService(t *testing.T) { Return(&hcloud.Certificate{ID: 1}, nil, nil) fx.Client.LoadBalancerClient.EXPECT(). UpdateService(gomock.Any(), &hcloud.LoadBalancer{ID: 123}, 80, hcloud.LoadBalancerUpdateServiceOpts{ - DestinationPort: hcloud.Ptr(8080), + DestinationPort: new(8080), Protocol: hcloud.LoadBalancerServiceProtocolTCP, - Proxyprotocol: hcloud.Ptr(true), + Proxyprotocol: new(true), HTTP: &hcloud.LoadBalancerUpdateServiceOptsHTTP{ - RedirectHTTP: hcloud.Ptr(true), - StickySessions: hcloud.Ptr(true), - CookieName: hcloud.Ptr("test"), + RedirectHTTP: new(true), + StickySessions: new(true), + CookieName: new("test"), CookieLifetime: hcloud.Ptr(10 * time.Minute), Certificates: []*hcloud.Certificate{{ID: 1}}, TimeoutIdle: hcloud.Ptr(60 * time.Second), }, HealthCheck: &hcloud.LoadBalancerUpdateServiceOptsHealthCheck{ Protocol: hcloud.LoadBalancerServiceProtocolTCP, - Port: hcloud.Ptr(8080), + Port: new(8080), Interval: hcloud.Ptr(10 * time.Second), Timeout: hcloud.Ptr(5 * time.Second), - Retries: hcloud.Ptr(2), + Retries: new(2), HTTP: &hcloud.LoadBalancerUpdateServiceOptsHealthCheckHTTP{ - Domain: hcloud.Ptr("example.com"), - Path: hcloud.Ptr("/health"), + Domain: new("example.com"), + Path: new("/health"), StatusCodes: []string{"200"}, - Response: hcloud.Ptr("OK"), - TLS: hcloud.Ptr(true), + Response: new("OK"), + TLS: new(true), }, }, }). diff --git a/internal/cmd/network/change_protection_test.go b/internal/cmd/network/change_protection_test.go index 2f73dcd6d..038175d0e 100644 --- a/internal/cmd/network/change_protection_test.go +++ b/internal/cmd/network/change_protection_test.go @@ -26,7 +26,7 @@ func TestEnableProtection(t *testing.T) { Return(n, nil, nil) fx.Client.NetworkClient.EXPECT(). ChangeProtection(gomock.Any(), n, hcloud.NetworkChangeProtectionOpts{ - Delete: hcloud.Ptr(true), + Delete: new(true), }). Return(&hcloud.Action{ID: 789}, nil, nil) fx.ActionWaiter.EXPECT(). @@ -55,7 +55,7 @@ func TestDisableProtection(t *testing.T) { Return(n, nil, nil) fx.Client.NetworkClient.EXPECT(). ChangeProtection(gomock.Any(), n, hcloud.NetworkChangeProtectionOpts{ - Delete: hcloud.Ptr(false), + Delete: new(false), }). Return(&hcloud.Action{ID: 789}, nil, nil) fx.ActionWaiter.EXPECT(). diff --git a/internal/cmd/network/create_test.go b/internal/cmd/network/create_test.go index 63b71c2f4..669d70f3d 100644 --- a/internal/cmd/network/create_test.go +++ b/internal/cmd/network/create_test.go @@ -117,7 +117,7 @@ func TestCreateProtection(t *testing.T) { Return(n, nil, nil) fx.Client.NetworkClient.EXPECT(). ChangeProtection(gomock.Any(), n, hcloud.NetworkChangeProtectionOpts{ - Delete: hcloud.Ptr(true), + Delete: new(true), }). Return(&hcloud.Action{ID: 123}, nil, nil) fx.ActionWaiter.EXPECT().WaitForActions(gomock.Any(), gomock.Any(), &hcloud.Action{ID: 123}).Return(nil) diff --git a/internal/cmd/network/expose_routes_to_vswitch.go b/internal/cmd/network/expose_routes_to_vswitch.go index 6fb5261fa..b965cc825 100644 --- a/internal/cmd/network/expose_routes_to_vswitch.go +++ b/internal/cmd/network/expose_routes_to_vswitch.go @@ -39,7 +39,7 @@ var ExposeRoutesToVSwitchCmd = base.Cmd{ disable, _ := cmd.Flags().GetBool("disable") opts := hcloud.NetworkUpdateOpts{ - ExposeRoutesToVSwitch: hcloud.Ptr(!disable), + ExposeRoutesToVSwitch: new(!disable), } _, _, err = s.Client().Network().Update(s, network, opts) diff --git a/internal/cmd/network/expose_routes_to_vswitch_test.go b/internal/cmd/network/expose_routes_to_vswitch_test.go index a2a4dcf49..8c6083cca 100644 --- a/internal/cmd/network/expose_routes_to_vswitch_test.go +++ b/internal/cmd/network/expose_routes_to_vswitch_test.go @@ -26,7 +26,7 @@ func TestExposeRoutesToVSwitchEnable(t *testing.T) { Return(n, nil, nil) fx.Client.NetworkClient.EXPECT(). Update(gomock.Any(), n, hcloud.NetworkUpdateOpts{ - ExposeRoutesToVSwitch: hcloud.Ptr(true), + ExposeRoutesToVSwitch: new(true), }). Return(n, nil, nil) @@ -52,7 +52,7 @@ func TestExposeRoutesToVSwitchDisable(t *testing.T) { Return(n, nil, nil) fx.Client.NetworkClient.EXPECT(). Update(gomock.Any(), n, hcloud.NetworkUpdateOpts{ - ExposeRoutesToVSwitch: hcloud.Ptr(false), + ExposeRoutesToVSwitch: new(false), }). Return(n, nil, nil) diff --git a/internal/cmd/primaryip/create_test.go b/internal/cmd/primaryip/create_test.go index a6f10eb09..f674551cb 100644 --- a/internal/cmd/primaryip/create_test.go +++ b/internal/cmd/primaryip/create_test.go @@ -41,7 +41,7 @@ func TestCreate(t *testing.T) { Type: "ipv4", Location: "fsn1", Labels: map[string]string{"foo": "bar"}, - AutoDelete: hcloud.Ptr(true), + AutoDelete: new(true), }, ). Return( @@ -106,7 +106,7 @@ func TestCreateJSON(t *testing.T) { Type: "ipv4", Location: "fsn1", Labels: map[string]string{"foo": "bar"}, - AutoDelete: hcloud.Ptr(true), + AutoDelete: new(true), }, ). Return( diff --git a/internal/cmd/primaryip/labels_test.go b/internal/cmd/primaryip/labels_test.go index 36af4efa6..db01fab89 100644 --- a/internal/cmd/primaryip/labels_test.go +++ b/internal/cmd/primaryip/labels_test.go @@ -24,7 +24,7 @@ func TestLabelAdd(t *testing.T) { Return(&hcloud.PrimaryIP{ID: 123}, nil, nil) fx.Client.PrimaryIPClient.EXPECT(). Update(gomock.Any(), &hcloud.PrimaryIP{ID: 123}, hcloud.PrimaryIPUpdateOpts{ - Labels: hcloud.Ptr(map[string]string{ + Labels: new(map[string]string{ "key": "value", }), }) @@ -57,7 +57,7 @@ func TestLabelRemove(t *testing.T) { Return(primaryIP, nil, nil) fx.Client.PrimaryIPClient.EXPECT(). Update(gomock.Any(), primaryIP, hcloud.PrimaryIPUpdateOpts{ - Labels: hcloud.Ptr(make(map[string]string)), + Labels: new(make(map[string]string)), }) out, errOut, err := fx.Run(cmd, []string{"123", "key"}) diff --git a/internal/cmd/primaryip/set_rdns_test.go b/internal/cmd/primaryip/set_rdns_test.go index 3629cd575..917b75a0d 100644 --- a/internal/cmd/primaryip/set_rdns_test.go +++ b/internal/cmd/primaryip/set_rdns_test.go @@ -35,7 +35,7 @@ func TestSetRDNS(t *testing.T) { gomock.Any(), &hcloud.PrimaryIP{ID: 13}, net.ParseIP("192.168.0.1"), - hcloud.Ptr("server.your-host.de"), + new("server.your-host.de"), ). Return( action, diff --git a/internal/cmd/primaryip/update.go b/internal/cmd/primaryip/update.go index 306994169..63b97e154 100644 --- a/internal/cmd/primaryip/update.go +++ b/internal/cmd/primaryip/update.go @@ -28,7 +28,7 @@ var UpdateCmd = base.UpdateCmd[*hcloud.PrimaryIP]{ if cmd.Flags().Changed("auto-delete") { autoDelete, _ := cmd.Flags().GetBool("auto-delete") - updOpts.AutoDelete = hcloud.Ptr(autoDelete) + updOpts.AutoDelete = new(autoDelete) } _, _, err := s.Client().PrimaryIP().Update(s, primaryIP, updOpts) diff --git a/internal/cmd/primaryip/update_test.go b/internal/cmd/primaryip/update_test.go index 13c0b4bbf..ca235d927 100644 --- a/internal/cmd/primaryip/update_test.go +++ b/internal/cmd/primaryip/update_test.go @@ -49,7 +49,7 @@ func TestUpdateAutoDelete(t *testing.T) { Return(&hcloud.PrimaryIP{ID: 123}, nil, nil) fx.Client.PrimaryIPClient.EXPECT(). Update(gomock.Any(), &hcloud.PrimaryIP{ID: 123}, hcloud.PrimaryIPUpdateOpts{ - AutoDelete: hcloud.Ptr(false), + AutoDelete: new(false), }) out, errOut, err := fx.Run(cmd, []string{"123", "--auto-delete=false"}) diff --git a/internal/cmd/server/change_protection_test.go b/internal/cmd/server/change_protection_test.go index 8a3ceaae3..4e5f13b5d 100644 --- a/internal/cmd/server/change_protection_test.go +++ b/internal/cmd/server/change_protection_test.go @@ -26,8 +26,8 @@ func TestEnableProtection(t *testing.T) { Return(srv, nil, nil) fx.Client.ServerClient.EXPECT(). ChangeProtection(gomock.Any(), srv, hcloud.ServerChangeProtectionOpts{ - Delete: hcloud.Ptr(false), - Rebuild: hcloud.Ptr(false), + Delete: new(false), + Rebuild: new(false), }). Return(&hcloud.Action{ID: 789}, nil, nil) fx.ActionWaiter.EXPECT(). @@ -56,8 +56,8 @@ func TestDisableProtection(t *testing.T) { Return(srv, nil, nil) fx.Client.ServerClient.EXPECT(). ChangeProtection(gomock.Any(), srv, hcloud.ServerChangeProtectionOpts{ - Delete: hcloud.Ptr(false), - Rebuild: hcloud.Ptr(false), + Delete: new(false), + Rebuild: new(false), }). Return(&hcloud.Action{ID: 789}, nil, nil) fx.ActionWaiter.EXPECT(). diff --git a/internal/cmd/server/create_image.go b/internal/cmd/server/create_image.go index 63b8ef0c0..710f2c8d6 100644 --- a/internal/cmd/server/create_image.go +++ b/internal/cmd/server/create_image.go @@ -51,7 +51,7 @@ var CreateImageCmd = base.Cmd{ opts := &hcloud.ServerCreateImageOpts{ Type: hcloud.ImageType(imageType), - Description: hcloud.Ptr(description), + Description: new(description), Labels: labels, } result, _, err := s.Client().Server().CreateImage(s, server, opts) diff --git a/internal/cmd/server/create_image_test.go b/internal/cmd/server/create_image_test.go index 5391fb5bf..4f173b8ed 100644 --- a/internal/cmd/server/create_image_test.go +++ b/internal/cmd/server/create_image_test.go @@ -27,7 +27,7 @@ func TestCreateImage(t *testing.T) { fx.Client.ServerClient.EXPECT(). CreateImage(gomock.Any(), srv, &hcloud.ServerCreateImageOpts{ Type: hcloud.ImageTypeSnapshot, - Description: hcloud.Ptr("my-snapshot"), + Description: new("my-snapshot"), Labels: make(map[string]string), }). Return(hcloud.ServerCreateImageResult{ diff --git a/internal/cmd/server/create_test.go b/internal/cmd/server/create_test.go index a778a3475..996baf57a 100644 --- a/internal/cmd/server/create_test.go +++ b/internal/cmd/server/create_test.go @@ -269,7 +269,7 @@ func TestCreateProtectionBackup(t *testing.T) { fx.Client.ServerClient.EXPECT(). ChangeProtection(gomock.Any(), srv, hcloud.ServerChangeProtectionOpts{ - Rebuild: hcloud.Ptr(true), Delete: hcloud.Ptr(true), + Rebuild: new(true), Delete: new(true), }). Return(&hcloud.Action{ ID: 1337, diff --git a/internal/cmd/server/set_rdns_test.go b/internal/cmd/server/set_rdns_test.go index 95a2f2b34..f2862ba4f 100644 --- a/internal/cmd/server/set_rdns_test.go +++ b/internal/cmd/server/set_rdns_test.go @@ -30,7 +30,7 @@ func TestSetRDNS(t *testing.T) { Get(gomock.Any(), "my-server"). Return(srv, nil, nil) fx.Client.RDNSClient.EXPECT(). - ChangeDNSPtr(gomock.Any(), srv, net.ParseIP("127.0.0.1"), hcloud.Ptr("s1.example.com")). + ChangeDNSPtr(gomock.Any(), srv, net.ParseIP("127.0.0.1"), new("s1.example.com")). Return(&hcloud.Action{ID: 789}, nil, nil) fx.ActionWaiter.EXPECT(). WaitForActions(gomock.Any(), gomock.Any(), &hcloud.Action{ID: 789}). diff --git a/internal/cmd/server/ssh.go b/internal/cmd/server/ssh.go index b2c0a0d29..539420123 100644 --- a/internal/cmd/server/ssh.go +++ b/internal/cmd/server/ssh.go @@ -66,8 +66,7 @@ var SSHCmd = base.Cmd{ sshCommand.Stderr = os.Stderr if err := sshCommand.Run(); err != nil { - var exitError *exec.ExitError - if errors.As(err, &exitError) { + if exitError, ok := errors.AsType[*exec.ExitError](err); ok { waitStatus := exitError.Sys().(syscall.WaitStatus) os.Exit(waitStatus.ExitStatus()) } diff --git a/internal/cmd/storagebox/change_protection_test.go b/internal/cmd/storagebox/change_protection_test.go index 684e129ee..abd8c3c1e 100644 --- a/internal/cmd/storagebox/change_protection_test.go +++ b/internal/cmd/storagebox/change_protection_test.go @@ -24,7 +24,7 @@ func TestEnableProtection(t *testing.T) { Return(&hcloud.StorageBox{ID: 123}, nil, nil) fx.Client.StorageBoxClient.EXPECT(). ChangeProtection(gomock.Any(), &hcloud.StorageBox{ID: 123}, hcloud.StorageBoxChangeProtectionOpts{ - Delete: hcloud.Ptr(true), + Delete: new(true), }). Return(&hcloud.Action{ID: 123}, nil, nil) fx.ActionWaiter.EXPECT(). @@ -52,7 +52,7 @@ func TestDisableProtection(t *testing.T) { Return(&hcloud.StorageBox{ID: 123}, nil, nil) fx.Client.StorageBoxClient.EXPECT(). ChangeProtection(gomock.Any(), &hcloud.StorageBox{ID: 123}, hcloud.StorageBoxChangeProtectionOpts{ - Delete: hcloud.Ptr(false), + Delete: new(false), }). Return(&hcloud.Action{ID: 123}, nil, nil) fx.ActionWaiter.EXPECT(). diff --git a/internal/cmd/storagebox/create_test.go b/internal/cmd/storagebox/create_test.go index f29c5f52f..c58c210ee 100644 --- a/internal/cmd/storagebox/create_test.go +++ b/internal/cmd/storagebox/create_test.go @@ -46,9 +46,9 @@ func TestCreate(t *testing.T) { Location: &hcloud.Location{Name: "fsn1"}, Password: "my-password", AccessSettings: &hcloud.StorageBoxCreateOptsAccessSettings{ - SambaEnabled: hcloud.Ptr(true), - SSHEnabled: hcloud.Ptr(true), - ZFSEnabled: hcloud.Ptr(true), + SambaEnabled: new(true), + SSHEnabled: new(true), + ZFSEnabled: new(true), }, Labels: make(map[string]string), SSHKeys: []*hcloud.SSHKey{sshKey1, sshKey2}, @@ -94,8 +94,8 @@ func TestCreateJSON(t *testing.T) { ID: 42, Name: "bx11", Description: "BX11", - SnapshotLimit: hcloud.Ptr(10), - AutomaticSnapshotLimit: hcloud.Ptr(10), + SnapshotLimit: new(10), + AutomaticSnapshotLimit: new(10), SubaccountsLimit: 200, Size: 1073741824, Pricings: []hcloud.StorageBoxTypeLocationPricing{ @@ -171,9 +171,9 @@ func TestCreateJSON(t *testing.T) { Location: &hcloud.Location{Name: "fsn1"}, Password: "my-password", AccessSettings: &hcloud.StorageBoxCreateOptsAccessSettings{ - SambaEnabled: hcloud.Ptr(true), - SSHEnabled: hcloud.Ptr(true), - ZFSEnabled: hcloud.Ptr(true), + SambaEnabled: new(true), + SSHEnabled: new(true), + ZFSEnabled: new(true), }, Labels: make(map[string]string), SSHKeys: []*hcloud.SSHKey{sshKey1}, @@ -220,9 +220,9 @@ func TestCreateProtection(t *testing.T) { Location: &hcloud.Location{Name: "fsn1"}, Password: "my-password", AccessSettings: &hcloud.StorageBoxCreateOptsAccessSettings{ - SambaEnabled: hcloud.Ptr(true), - SSHEnabled: hcloud.Ptr(true), - ZFSEnabled: hcloud.Ptr(true), + SambaEnabled: new(true), + SSHEnabled: new(true), + ZFSEnabled: new(true), }, Labels: make(map[string]string), SSHKeys: []*hcloud.SSHKey{sshKey1}, @@ -233,7 +233,7 @@ func TestCreateProtection(t *testing.T) { }, nil, nil) fx.Client.StorageBoxClient.EXPECT(). ChangeProtection(gomock.Any(), sb, hcloud.StorageBoxChangeProtectionOpts{ - Delete: hcloud.Ptr(true), + Delete: new(true), }). Return(&hcloud.Action{ID: 789}, nil, nil) fx.ActionWaiter.EXPECT(). diff --git a/internal/cmd/storagebox/describe_test.go b/internal/cmd/storagebox/describe_test.go index 4fa04e18e..e328c56ad 100644 --- a/internal/cmd/storagebox/describe_test.go +++ b/internal/cmd/storagebox/describe_test.go @@ -33,8 +33,8 @@ func TestDescribe(t *testing.T) { ID: 42, Name: "bx11", Description: "BX11", - SnapshotLimit: hcloud.Ptr(10), - AutomaticSnapshotLimit: hcloud.Ptr(10), + SnapshotLimit: new(10), + AutomaticSnapshotLimit: new(10), SubaccountsLimit: 200, Size: 1073741824, Pricings: []hcloud.StorageBoxTypeLocationPricing{ @@ -98,7 +98,7 @@ func TestDescribe(t *testing.T) { Minute: 1, Hour: 2, DayOfWeek: hcloud.Ptr(time.Sunday), - DayOfMonth: hcloud.Ptr(4), + DayOfMonth: new(4), }, Created: time.Date(2016, 1, 30, 23, 55, 0, 0, time.UTC), } diff --git a/internal/cmd/storagebox/list_test.go b/internal/cmd/storagebox/list_test.go index b1169668b..c20830d6f 100644 --- a/internal/cmd/storagebox/list_test.go +++ b/internal/cmd/storagebox/list_test.go @@ -49,7 +49,7 @@ func TestList(t *testing.T) { Minute: 1, Hour: 2, DayOfWeek: hcloud.Ptr(time.Sunday), - DayOfMonth: hcloud.Ptr(4), + DayOfMonth: new(4), }, Created: time.Now().Add(-3 * time.Hour), } diff --git a/internal/cmd/storagebox/snapshot/update_test.go b/internal/cmd/storagebox/snapshot/update_test.go index b662f8808..d316463cd 100644 --- a/internal/cmd/storagebox/snapshot/update_test.go +++ b/internal/cmd/storagebox/snapshot/update_test.go @@ -37,7 +37,7 @@ func TestUpdate(t *testing.T) { Return(sbs, nil, nil) fx.Client.StorageBoxClient.EXPECT(). UpdateSnapshot(gomock.Any(), sbs, hcloud.StorageBoxSnapshotUpdateOpts{ - Description: hcloud.Ptr("new description"), + Description: new("new description"), }) out, errOut, err := fx.Run(cmd, []string{"my-storage-box", "my-snapshot", "--description", "new description"}) diff --git a/internal/cmd/storagebox/subaccount/create_test.go b/internal/cmd/storagebox/subaccount/create_test.go index 6180f2d16..3e102b8bf 100644 --- a/internal/cmd/storagebox/subaccount/create_test.go +++ b/internal/cmd/storagebox/subaccount/create_test.go @@ -41,8 +41,8 @@ func TestCreate(t *testing.T) { HomeDirectory: "/home/directory", Password: "my-password", AccessSettings: &hcloud.StorageBoxSubaccountCreateOptsAccessSettings{ - Readonly: hcloud.Ptr(true), - SSHEnabled: hcloud.Ptr(true), + Readonly: new(true), + SSHEnabled: new(true), }, Labels: make(map[string]string), }). @@ -110,8 +110,8 @@ func TestCreateJSON(t *testing.T) { HomeDirectory: "/home/directory", Password: "my-password", AccessSettings: &hcloud.StorageBoxSubaccountCreateOptsAccessSettings{ - Readonly: hcloud.Ptr(true), - SSHEnabled: hcloud.Ptr(true), + Readonly: new(true), + SSHEnabled: new(true), }, Labels: make(map[string]string), }). diff --git a/internal/cmd/storagebox/subaccount/update_access_settings_test.go b/internal/cmd/storagebox/subaccount/update_access_settings_test.go index 38d1850b4..27f1db423 100644 --- a/internal/cmd/storagebox/subaccount/update_access_settings_test.go +++ b/internal/cmd/storagebox/subaccount/update_access_settings_test.go @@ -31,10 +31,10 @@ func TestUpdateAccessSettings(t *testing.T) { fx.Client.StorageBoxClient.EXPECT(). UpdateSubaccountAccessSettings(gomock.Any(), sbs, hcloud.StorageBoxSubaccountUpdateAccessSettingsOpts{ SambaEnabled: nil, - SSHEnabled: hcloud.Ptr(true), - WebDAVEnabled: hcloud.Ptr(false), + SSHEnabled: new(true), + WebDAVEnabled: new(false), ReachableExternally: nil, - Readonly: hcloud.Ptr(true), + Readonly: new(true), }). Return(&hcloud.Action{ID: 456}, nil, nil) fx.ActionWaiter.EXPECT(). diff --git a/internal/cmd/storagebox/subaccount/update_test.go b/internal/cmd/storagebox/subaccount/update_test.go index 44ba5793a..ad7114e51 100644 --- a/internal/cmd/storagebox/subaccount/update_test.go +++ b/internal/cmd/storagebox/subaccount/update_test.go @@ -36,7 +36,7 @@ func TestUpdate(t *testing.T) { Return(sbs, nil, nil) fx.Client.StorageBoxClient.EXPECT(). UpdateSubaccount(gomock.Any(), sbs, hcloud.StorageBoxSubaccountUpdateOpts{ - Description: hcloud.Ptr("new description"), + Description: new("new description"), }) out, errOut, err := fx.Run(cmd, []string{"my-storage-box", "456", "--description", "new description"}) diff --git a/internal/cmd/storagebox/update_access_settings_test.go b/internal/cmd/storagebox/update_access_settings_test.go index 7d032695a..96c54a6f6 100644 --- a/internal/cmd/storagebox/update_access_settings_test.go +++ b/internal/cmd/storagebox/update_access_settings_test.go @@ -27,9 +27,9 @@ func TestUpdateAccessSettings(t *testing.T) { fx.Client.StorageBoxClient.EXPECT(). UpdateAccessSettings(gomock.Any(), sb, hcloud.StorageBoxUpdateAccessSettingsOpts{ SambaEnabled: nil, - SSHEnabled: hcloud.Ptr(true), - WebDAVEnabled: hcloud.Ptr(false), - ZFSEnabled: hcloud.Ptr(true), + SSHEnabled: new(true), + WebDAVEnabled: new(false), + ZFSEnabled: new(true), ReachableExternally: nil, }). Return(&hcloud.Action{ID: 456}, nil, nil) diff --git a/internal/cmd/storageboxtype/describe_test.go b/internal/cmd/storageboxtype/describe_test.go index ca1e4924a..f89bf7094 100644 --- a/internal/cmd/storageboxtype/describe_test.go +++ b/internal/cmd/storageboxtype/describe_test.go @@ -25,8 +25,8 @@ func TestDescribe(t *testing.T) { ID: 42, Name: "bx11", Description: "BX11", - SnapshotLimit: hcloud.Ptr(10), - AutomaticSnapshotLimit: hcloud.Ptr(10), + SnapshotLimit: new(10), + AutomaticSnapshotLimit: new(10), SubaccountsLimit: 200, Size: 1073741824, Pricings: []hcloud.StorageBoxTypeLocationPricing{ diff --git a/internal/cmd/storageboxtype/list_test.go b/internal/cmd/storageboxtype/list_test.go index 4e60e9dcf..382936828 100644 --- a/internal/cmd/storageboxtype/list_test.go +++ b/internal/cmd/storageboxtype/list_test.go @@ -34,8 +34,8 @@ func TestList(t *testing.T) { ID: 42, Name: "bx11", Description: "BX11", - SnapshotLimit: hcloud.Ptr(10), - AutomaticSnapshotLimit: hcloud.Ptr(10), + SnapshotLimit: new(10), + AutomaticSnapshotLimit: new(10), SubaccountsLimit: 200, Size: 1073741824, Pricings: []hcloud.StorageBoxTypeLocationPricing{}, diff --git a/internal/cmd/util/util_test.go b/internal/cmd/util/util_test.go index 439265a5f..91a3e1423 100644 --- a/internal/cmd/util/util_test.go +++ b/internal/cmd/util/util_test.go @@ -486,8 +486,8 @@ func TestOrZero(t *testing.T) { assert.Empty(t, util.OrZero[string](nil)) assert.Equal(t, 0, util.OrZero[int](nil)) assert.False(t, util.OrZero[bool](nil)) - assert.Equal(t, 42, util.OrZero(hcloud.Ptr(42))) - assert.Equal(t, "abc", util.OrZero(hcloud.Ptr("abc"))) + assert.Equal(t, 42, util.OrZero(new(42))) + assert.Equal(t, "abc", util.OrZero(new("abc"))) } func TestFormatHcloudError(t *testing.T) { diff --git a/internal/cmd/volume/attach_test.go b/internal/cmd/volume/attach_test.go index 5f9f18117..0110d82e8 100644 --- a/internal/cmd/volume/attach_test.go +++ b/internal/cmd/volume/attach_test.go @@ -31,7 +31,7 @@ func TestAttach(t *testing.T) { fx.Client.VolumeClient.EXPECT(). AttachWithOpts(gomock.Any(), v, hcloud.VolumeAttachOpts{ Server: srv, - Automount: hcloud.Ptr(false), + Automount: new(false), }).Return(&hcloud.Action{ID: 321}, nil, nil) fx.ActionWaiter.EXPECT(). WaitForActions(gomock.Any(), gomock.Any(), &hcloud.Action{ID: 321}). diff --git a/internal/cmd/volume/change_protection_test.go b/internal/cmd/volume/change_protection_test.go index 1cfc2b543..5d289d81f 100644 --- a/internal/cmd/volume/change_protection_test.go +++ b/internal/cmd/volume/change_protection_test.go @@ -26,7 +26,7 @@ func TestEnableProtection(t *testing.T) { Return(v, nil, nil) fx.Client.VolumeClient.EXPECT(). ChangeProtection(gomock.Any(), v, hcloud.VolumeChangeProtectionOpts{ - Delete: hcloud.Ptr(true), + Delete: new(true), }). Return(&hcloud.Action{ID: 789}, nil, nil) fx.ActionWaiter.EXPECT(). @@ -55,7 +55,7 @@ func TestDisableProtection(t *testing.T) { Return(v, nil, nil) fx.Client.VolumeClient.EXPECT(). ChangeProtection(gomock.Any(), v, hcloud.VolumeChangeProtectionOpts{ - Delete: hcloud.Ptr(false), + Delete: new(false), }). Return(&hcloud.Action{ID: 789}, nil, nil) fx.ActionWaiter.EXPECT(). diff --git a/internal/cmd/volume/create_test.go b/internal/cmd/volume/create_test.go index 422e875e1..e8a5bc496 100644 --- a/internal/cmd/volume/create_test.go +++ b/internal/cmd/volume/create_test.go @@ -138,7 +138,7 @@ func TestCreateProtection(t *testing.T) { WaitForActions(gomock.Any(), gomock.Any(), []*hcloud.Action{{ID: 321}, {ID: 1}, {ID: 2}, {ID: 3}}) fx.Client.VolumeClient.EXPECT(). ChangeProtection(gomock.Any(), v, hcloud.VolumeChangeProtectionOpts{ - Delete: hcloud.Ptr(true), + Delete: new(true), }). Return(&hcloud.Action{ID: 123}, nil, nil) fx.ActionWaiter.EXPECT(). diff --git a/internal/cmd/zone/change_protection_test.go b/internal/cmd/zone/change_protection_test.go index 5269e9bda..af97cfab9 100644 --- a/internal/cmd/zone/change_protection_test.go +++ b/internal/cmd/zone/change_protection_test.go @@ -26,7 +26,7 @@ func TestEnableProtection(t *testing.T) { Return(z, nil, nil) fx.Client.ZoneClient.EXPECT(). ChangeProtection(gomock.Any(), z, hcloud.ZoneChangeProtectionOpts{ - Delete: hcloud.Ptr(true), + Delete: new(true), }). Return(&hcloud.Action{ID: 789}, nil, nil) fx.ActionWaiter.EXPECT(). @@ -55,7 +55,7 @@ func TestDisableProtection(t *testing.T) { Return(z, nil, nil) fx.Client.ZoneClient.EXPECT(). ChangeProtection(gomock.Any(), z, hcloud.ZoneChangeProtectionOpts{ - Delete: hcloud.Ptr(false), + Delete: new(false), }). Return(&hcloud.Action{ID: 789}, nil, nil) fx.ActionWaiter.EXPECT(). diff --git a/internal/cmd/zone/create_test.go b/internal/cmd/zone/create_test.go index 79ac42298..6b084dd58 100644 --- a/internal/cmd/zone/create_test.go +++ b/internal/cmd/zone/create_test.go @@ -28,7 +28,7 @@ func TestCreate(t *testing.T) { Create(gomock.Any(), hcloud.ZoneCreateOpts{ Name: "example.com", Mode: hcloud.ZoneModePrimary, - TTL: hcloud.Ptr(600), + TTL: new(600), Labels: map[string]string{"foo": "bar"}, }). Return(hcloud.ZoneCreateResult{ @@ -86,7 +86,7 @@ func TestCreateJSON(t *testing.T) { Create(gomock.Any(), hcloud.ZoneCreateOpts{ Name: "example.com", Mode: hcloud.ZoneModePrimary, - TTL: hcloud.Ptr(600), + TTL: new(600), Labels: map[string]string{"foo": "bar"}, }). Return(hcloud.ZoneCreateResult{ diff --git a/internal/cmd/zone/rrset/change_protection_test.go b/internal/cmd/zone/rrset/change_protection_test.go index 516a5a93e..5e9be5ac9 100644 --- a/internal/cmd/zone/rrset/change_protection_test.go +++ b/internal/cmd/zone/rrset/change_protection_test.go @@ -39,7 +39,7 @@ func TestEnableProtection(t *testing.T) { Return(rrSet, nil, nil) fx.Client.ZoneClient.EXPECT(). ChangeRRSetProtection(gomock.Any(), rrSet, hcloud.ZoneRRSetChangeProtectionOpts{ - Change: hcloud.Ptr(true), + Change: new(true), }). Return(&hcloud.Action{ID: 789}, nil, nil) fx.ActionWaiter.EXPECT(). @@ -81,7 +81,7 @@ func TestDisableProtection(t *testing.T) { Return(rrSet, nil, nil) fx.Client.ZoneClient.EXPECT(). ChangeRRSetProtection(gomock.Any(), rrSet, hcloud.ZoneRRSetChangeProtectionOpts{ - Change: hcloud.Ptr(false), + Change: new(false), }). Return(&hcloud.Action{ID: 789}, nil, nil) fx.ActionWaiter.EXPECT(). diff --git a/internal/cmd/zone/rrset/change_ttl_test.go b/internal/cmd/zone/rrset/change_ttl_test.go index ab054694e..c2ee0af15 100644 --- a/internal/cmd/zone/rrset/change_ttl_test.go +++ b/internal/cmd/zone/rrset/change_ttl_test.go @@ -39,7 +39,7 @@ func TestChangeTTL(t *testing.T) { GetRRSetByNameAndType(gomock.Any(), z, "www", hcloud.ZoneRRSetTypeA). Return(rrSet, nil, nil) fx.Client.ZoneClient.EXPECT(). - ChangeRRSetTTL(gomock.Any(), rrSet, hcloud.ZoneRRSetChangeTTLOpts{TTL: hcloud.Ptr(1337)}). + ChangeRRSetTTL(gomock.Any(), rrSet, hcloud.ZoneRRSetChangeTTLOpts{TTL: new(1337)}). Return(&hcloud.Action{ID: 321}, nil, nil) fx.ActionWaiter.EXPECT(). WaitForActions(gomock.Any(), gomock.Any(), []*hcloud.Action{{ID: 321}}) diff --git a/internal/cmd/zone/rrset/create_test.go b/internal/cmd/zone/rrset/create_test.go index 9dac21f5a..7bd7fa8ab 100644 --- a/internal/cmd/zone/rrset/create_test.go +++ b/internal/cmd/zone/rrset/create_test.go @@ -38,7 +38,7 @@ func TestCreate(t *testing.T) { Labels: map[string]string{ "foo": "bar", }, - TTL: hcloud.Ptr(42), + TTL: new(42), }). Return(hcloud.ZoneRRSetCreateResult{ RRSet: &hcloud.ZoneRRSet{ diff --git a/internal/cmd/zone/rrset/describe_test.go b/internal/cmd/zone/rrset/describe_test.go index 16565c349..564c22275 100644 --- a/internal/cmd/zone/rrset/describe_test.go +++ b/internal/cmd/zone/rrset/describe_test.go @@ -32,7 +32,7 @@ func TestDescribe(t *testing.T) { ID: "www/A", Name: "www", Type: hcloud.ZoneRRSetTypeA, - TTL: hcloud.Ptr(600), + TTL: new(600), Labels: map[string]string{ "environment": "prod", "example.com/my": "label", diff --git a/internal/cmd/zone/rrset/list_test.go b/internal/cmd/zone/rrset/list_test.go index 936b1c407..b5d7b854d 100644 --- a/internal/cmd/zone/rrset/list_test.go +++ b/internal/cmd/zone/rrset/list_test.go @@ -31,7 +31,7 @@ func TestList(t *testing.T) { ID: "www/A", Name: "www", Type: hcloud.ZoneRRSetTypeA, - TTL: hcloud.Ptr(600), + TTL: new(600), Labels: map[string]string{ "environment": "prod", "example.com/my": "label",