From f562c529163392dca8a0da077b2fbbdc7bb91164 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20T=C3=B6lle?= Date: Thu, 10 Nov 2022 15:19:43 +0100 Subject: [PATCH] fix: error when generating mocks While generating mocks for new methods from hcloud-go 1.37.0 we encountered following error log when running `go generate`: prog.go:12:2: no required module provides package github.com/golang/mock/mockgen/model: go.mod file not found in current directory or any parent directory; see 'go help modules' prog.go:14:2: no required module provides package github.com/hetznercloud/cli/internal/hcapi2: go.mod file not found in current directory or any parent directory; see 'go help modules' 2022/11/10 14:52:03 Loading input failed: exit status 1 internal/hcapi2/mock_gen.go:3: running "mockgen": exit status 1 This was solved by moving the mocks into a seperate package. --- internal/hcapi2/client.go | 108 ----------------- internal/hcapi2/mock/client.go | 113 ++++++++++++++++++ internal/hcapi2/mock/mock_gen.go | 19 +++ .../{ => mock}/zz_certificate_client_mock.go | 4 +- .../{ => mock}/zz_datacenter_client_mock.go | 4 +- .../{ => mock}/zz_firewall_client_mock.go | 4 +- .../{ => mock}/zz_floating_ip_client_mock.go | 4 +- .../hcapi2/{ => mock}/zz_image_client_mock.go | 4 +- .../hcapi2/{ => mock}/zz_iso_client_mock.go | 4 +- .../{ => mock}/zz_loadbalancer_client_mock.go | 4 +- .../zz_loadbalancer_type_client_mock.go | 4 +- .../{ => mock}/zz_location_client_mock.go | 4 +- .../{ => mock}/zz_network_client_mock.go | 4 +- .../zz_placement_group_client_mock.go | 4 +- .../{ => mock}/zz_primary_ip_client_mock.go | 4 +- .../hcapi2/{ => mock}/zz_rdns_client_mock.go | 4 +- .../{ => mock}/zz_server_client_mock.go | 4 +- .../{ => mock}/zz_server_type_client_mock.go | 4 +- .../{ => mock}/zz_ssh_key_client_mock.go | 4 +- .../{ => mock}/zz_volume_client_mock.go | 4 +- internal/hcapi2/mock_gen.go | 19 --- internal/hcapi2/zz_certificate_client_base.go | 1 - internal/hcapi2/zz_datacenter_client_base.go | 1 - internal/hcapi2/zz_firewall_client_base.go | 1 - internal/hcapi2/zz_floating_ip_client_base.go | 1 - internal/hcapi2/zz_image_client_base.go | 1 - internal/hcapi2/zz_iso_client_base.go | 1 - .../hcapi2/zz_loadbalancer_client_base.go | 3 +- .../zz_loadbalancer_type_client_base.go | 1 - internal/hcapi2/zz_location_client_base.go | 1 - internal/hcapi2/zz_network_client_base.go | 1 - .../hcapi2/zz_placement_group_client_base.go | 1 - internal/hcapi2/zz_primary_ip_client_base.go | 1 - internal/hcapi2/zz_rdns_client_base.go | 3 +- internal/hcapi2/zz_server_client_base.go | 1 - internal/hcapi2/zz_server_type_client_base.go | 1 - internal/hcapi2/zz_ssh_key_client_base.go | 1 - internal/hcapi2/zz_volume_client_base.go | 1 - internal/testutil/fixture.go | 6 +- 39 files changed, 171 insertions(+), 183 deletions(-) create mode 100644 internal/hcapi2/mock/client.go create mode 100644 internal/hcapi2/mock/mock_gen.go rename internal/hcapi2/{ => mock}/zz_certificate_client_mock.go (99%) rename internal/hcapi2/{ => mock}/zz_datacenter_client_mock.go (98%) rename internal/hcapi2/{ => mock}/zz_firewall_client_mock.go (99%) rename internal/hcapi2/{ => mock}/zz_floating_ip_client_mock.go (99%) rename internal/hcapi2/{ => mock}/zz_image_client_mock.go (99%) rename internal/hcapi2/{ => mock}/zz_iso_client_mock.go (98%) rename internal/hcapi2/{ => mock}/zz_loadbalancer_client_mock.go (99%) rename internal/hcapi2/{ => mock}/zz_loadbalancer_type_client_mock.go (98%) rename internal/hcapi2/{ => mock}/zz_location_client_mock.go (98%) rename internal/hcapi2/{ => mock}/zz_network_client_mock.go (99%) rename internal/hcapi2/{ => mock}/zz_placement_group_client_mock.go (99%) rename internal/hcapi2/{ => mock}/zz_primary_ip_client_mock.go (99%) rename internal/hcapi2/{ => mock}/zz_rdns_client_mock.go (95%) rename internal/hcapi2/{ => mock}/zz_server_client_mock.go (99%) rename internal/hcapi2/{ => mock}/zz_server_type_client_mock.go (98%) rename internal/hcapi2/{ => mock}/zz_ssh_key_client_mock.go (99%) rename internal/hcapi2/{ => mock}/zz_volume_client_mock.go (99%) delete mode 100644 internal/hcapi2/mock_gen.go diff --git a/internal/hcapi2/client.go b/internal/hcapi2/client.go index 74c79b9d..ca8c5357 100644 --- a/internal/hcapi2/client.go +++ b/internal/hcapi2/client.go @@ -3,7 +3,6 @@ package hcapi2 import ( "sync" - "github.com/golang/mock/gomock" "github.com/hetznercloud/hcloud-go/hcloud" ) @@ -206,110 +205,3 @@ func (c *client) PlacementGroup() PlacementGroupClient { defer c.mu.Unlock() return c.placementGroupClient } - -type MockClient struct { - CertificateClient *MockCertificateClient - DatacenterClient *MockDatacenterClient - FirewallClient *MockFirewallClient - FloatingIPClient *MockFloatingIPClient - PrimaryIPClient *MockPrimaryIPClient - ImageClient *MockImageClient - LocationClient *MockLocationClient - LoadBalancerClient *MockLoadBalancerClient - LoadBalancerTypeClient *MockLoadBalancerTypeClient - NetworkClient *MockNetworkClient - ServerClient *MockServerClient - ServerTypeClient *MockServerTypeClient - SSHKeyClient *MockSSHKeyClient - VolumeClient *MockVolumeClient - ISOClient *MockISOClient - PlacementGroupClient *MockPlacementGroupClient - RDNSClient *MockRDNSClient -} - -func NewMockClient(ctrl *gomock.Controller) *MockClient { - return &MockClient{ - CertificateClient: NewMockCertificateClient(ctrl), - DatacenterClient: NewMockDatacenterClient(ctrl), - FirewallClient: NewMockFirewallClient(ctrl), - FloatingIPClient: NewMockFloatingIPClient(ctrl), - PrimaryIPClient: NewMockPrimaryIPClient(ctrl), - ImageClient: NewMockImageClient(ctrl), - LocationClient: NewMockLocationClient(ctrl), - LoadBalancerClient: NewMockLoadBalancerClient(ctrl), - LoadBalancerTypeClient: NewMockLoadBalancerTypeClient(ctrl), - NetworkClient: NewMockNetworkClient(ctrl), - ServerClient: NewMockServerClient(ctrl), - ServerTypeClient: NewMockServerTypeClient(ctrl), - SSHKeyClient: NewMockSSHKeyClient(ctrl), - VolumeClient: NewMockVolumeClient(ctrl), - ISOClient: NewMockISOClient(ctrl), - PlacementGroupClient: NewMockPlacementGroupClient(ctrl), - RDNSClient: NewMockRDNSClient(ctrl), - } -} -func (c *MockClient) Certificate() CertificateClient { - return c.CertificateClient -} -func (c *MockClient) Datacenter() DatacenterClient { - return c.DatacenterClient -} - -func (c *MockClient) Firewall() FirewallClient { - return c.FirewallClient -} - -func (c *MockClient) FloatingIP() FloatingIPClient { - return c.FloatingIPClient -} - -func (c *MockClient) PrimaryIP() PrimaryIPClient { - return c.PrimaryIPClient -} - -func (c *MockClient) Image() ImageClient { - return c.ImageClient -} - -func (c *MockClient) ISO() ISOClient { - return c.ISOClient -} - -func (c *MockClient) Location() LocationClient { - return c.LocationClient -} - -func (c *MockClient) LoadBalancer() LoadBalancerClient { - return c.LoadBalancerClient -} - -func (c *MockClient) LoadBalancerType() LoadBalancerTypeClient { - return c.LoadBalancerTypeClient -} - -func (c *MockClient) Network() NetworkClient { - return c.NetworkClient -} - -func (c *MockClient) Server() ServerClient { - return c.ServerClient -} - -func (c *MockClient) ServerType() ServerTypeClient { - return c.ServerTypeClient -} - -func (c *MockClient) SSHKey() SSHKeyClient { - return c.SSHKeyClient -} - -func (c *MockClient) Volume() VolumeClient { - return c.VolumeClient -} -func (c *MockClient) RDNS() RDNSClient { - return c.RDNSClient -} - -func (c *MockClient) PlacementGroup() PlacementGroupClient { - return c.PlacementGroupClient -} diff --git a/internal/hcapi2/mock/client.go b/internal/hcapi2/mock/client.go new file mode 100644 index 00000000..15c0894a --- /dev/null +++ b/internal/hcapi2/mock/client.go @@ -0,0 +1,113 @@ +package hcapi2_mock + +import ( + "github.com/golang/mock/gomock" + "github.com/hetznercloud/cli/internal/hcapi2" +) + +type MockClient struct { + CertificateClient *MockCertificateClient + DatacenterClient *MockDatacenterClient + FirewallClient *MockFirewallClient + FloatingIPClient *MockFloatingIPClient + PrimaryIPClient *MockPrimaryIPClient + ImageClient *MockImageClient + LocationClient *MockLocationClient + LoadBalancerClient *MockLoadBalancerClient + LoadBalancerTypeClient *MockLoadBalancerTypeClient + NetworkClient *MockNetworkClient + ServerClient *MockServerClient + ServerTypeClient *MockServerTypeClient + SSHKeyClient *MockSSHKeyClient + VolumeClient *MockVolumeClient + ISOClient *MockISOClient + PlacementGroupClient *MockPlacementGroupClient + RDNSClient *MockRDNSClient +} + +func NewMockClient(ctrl *gomock.Controller) *MockClient { + return &MockClient{ + CertificateClient: NewMockCertificateClient(ctrl), + DatacenterClient: NewMockDatacenterClient(ctrl), + FirewallClient: NewMockFirewallClient(ctrl), + FloatingIPClient: NewMockFloatingIPClient(ctrl), + PrimaryIPClient: NewMockPrimaryIPClient(ctrl), + ImageClient: NewMockImageClient(ctrl), + LocationClient: NewMockLocationClient(ctrl), + LoadBalancerClient: NewMockLoadBalancerClient(ctrl), + LoadBalancerTypeClient: NewMockLoadBalancerTypeClient(ctrl), + NetworkClient: NewMockNetworkClient(ctrl), + ServerClient: NewMockServerClient(ctrl), + ServerTypeClient: NewMockServerTypeClient(ctrl), + SSHKeyClient: NewMockSSHKeyClient(ctrl), + VolumeClient: NewMockVolumeClient(ctrl), + ISOClient: NewMockISOClient(ctrl), + PlacementGroupClient: NewMockPlacementGroupClient(ctrl), + RDNSClient: NewMockRDNSClient(ctrl), + } +} +func (c *MockClient) Certificate() hcapi2.CertificateClient { + return c.CertificateClient +} +func (c *MockClient) Datacenter() hcapi2.DatacenterClient { + return c.DatacenterClient +} + +func (c *MockClient) Firewall() hcapi2.FirewallClient { + return c.FirewallClient +} + +func (c *MockClient) FloatingIP() hcapi2.FloatingIPClient { + return c.FloatingIPClient +} + +func (c *MockClient) PrimaryIP() hcapi2.PrimaryIPClient { + return c.PrimaryIPClient +} + +func (c *MockClient) Image() hcapi2.ImageClient { + return c.ImageClient +} + +func (c *MockClient) ISO() hcapi2.ISOClient { + return c.ISOClient +} + +func (c *MockClient) Location() hcapi2.LocationClient { + return c.LocationClient +} + +func (c *MockClient) LoadBalancer() hcapi2.LoadBalancerClient { + return c.LoadBalancerClient +} + +func (c *MockClient) LoadBalancerType() hcapi2.LoadBalancerTypeClient { + return c.LoadBalancerTypeClient +} + +func (c *MockClient) Network() hcapi2.NetworkClient { + return c.NetworkClient +} + +func (c *MockClient) Server() hcapi2.ServerClient { + return c.ServerClient +} + +func (c *MockClient) ServerType() hcapi2.ServerTypeClient { + return c.ServerTypeClient +} + +func (c *MockClient) SSHKey() hcapi2.SSHKeyClient { + return c.SSHKeyClient +} + +func (c *MockClient) Volume() hcapi2.VolumeClient { + return c.VolumeClient +} +func (c *MockClient) RDNS() hcapi2.RDNSClient { + return c.RDNSClient +} + +func (c *MockClient) PlacementGroup() hcapi2.PlacementGroupClient { + return c.PlacementGroupClient +} diff --git a/internal/hcapi2/mock/mock_gen.go b/internal/hcapi2/mock/mock_gen.go new file mode 100644 index 00000000..a38c491b --- /dev/null +++ b/internal/hcapi2/mock/mock_gen.go @@ -0,0 +1,19 @@ +package hcapi2_mock + +//go:generate mockgen -package hcapi2_mock -destination zz_certificate_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 CertificateClient +//go:generate mockgen -package hcapi2_mock -destination zz_datacenter_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 DatacenterClient +//go:generate mockgen -package hcapi2_mock -destination zz_image_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 ImageClient +//go:generate mockgen -package hcapi2_mock -destination zz_iso_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 ISOClient +//go:generate mockgen -package hcapi2_mock -destination zz_firewall_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 FirewallClient +//go:generate mockgen -package hcapi2_mock -destination zz_floating_ip_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 FloatingIPClient +//go:generate mockgen -package hcapi2_mock -destination zz_primary_ip_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 PrimaryIPClient +//go:generate mockgen -package hcapi2_mock -destination zz_location_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 LocationClient +//go:generate mockgen -package hcapi2_mock -destination zz_loadbalancer_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 LoadBalancerClient +//go:generate mockgen -package hcapi2_mock -destination zz_loadbalancer_type_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 LoadBalancerTypeClient +//go:generate mockgen -package hcapi2_mock -destination zz_network_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 NetworkClient +//go:generate mockgen -package hcapi2_mock -destination zz_server_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 ServerClient +//go:generate mockgen -package hcapi2_mock -destination zz_server_type_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 ServerTypeClient +//go:generate mockgen -package hcapi2_mock -destination zz_ssh_key_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 SSHKeyClient +//go:generate mockgen -package hcapi2_mock -destination zz_volume_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 VolumeClient +//go:generate mockgen -package hcapi2_mock -destination zz_placement_group_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 PlacementGroupClient +//go:generate mockgen -package hcapi2_mock -destination zz_rdns_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 RDNSClient diff --git a/internal/hcapi2/zz_certificate_client_mock.go b/internal/hcapi2/mock/zz_certificate_client_mock.go similarity index 99% rename from internal/hcapi2/zz_certificate_client_mock.go rename to internal/hcapi2/mock/zz_certificate_client_mock.go index abe3de4c..b1769190 100644 --- a/internal/hcapi2/zz_certificate_client_mock.go +++ b/internal/hcapi2/mock/zz_certificate_client_mock.go @@ -1,8 +1,8 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/hetznercloud/cli/internal/hcapi2 (interfaces: CertificateClient) -// Package hcapi2 is a generated GoMock package. -package hcapi2 +// Package hcapi2_mock is a generated GoMock package. +package hcapi2_mock import ( context "context" diff --git a/internal/hcapi2/zz_datacenter_client_mock.go b/internal/hcapi2/mock/zz_datacenter_client_mock.go similarity index 98% rename from internal/hcapi2/zz_datacenter_client_mock.go rename to internal/hcapi2/mock/zz_datacenter_client_mock.go index e7e54846..8d9e8ff0 100644 --- a/internal/hcapi2/zz_datacenter_client_mock.go +++ b/internal/hcapi2/mock/zz_datacenter_client_mock.go @@ -1,8 +1,8 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/hetznercloud/cli/internal/hcapi2 (interfaces: DatacenterClient) -// Package hcapi2 is a generated GoMock package. -package hcapi2 +// Package hcapi2_mock is a generated GoMock package. +package hcapi2_mock import ( context "context" diff --git a/internal/hcapi2/zz_firewall_client_mock.go b/internal/hcapi2/mock/zz_firewall_client_mock.go similarity index 99% rename from internal/hcapi2/zz_firewall_client_mock.go rename to internal/hcapi2/mock/zz_firewall_client_mock.go index cdf5e661..374c96bc 100644 --- a/internal/hcapi2/zz_firewall_client_mock.go +++ b/internal/hcapi2/mock/zz_firewall_client_mock.go @@ -1,8 +1,8 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/hetznercloud/cli/internal/hcapi2 (interfaces: FirewallClient) -// Package hcapi2 is a generated GoMock package. -package hcapi2 +// Package hcapi2_mock is a generated GoMock package. +package hcapi2_mock import ( context "context" diff --git a/internal/hcapi2/zz_floating_ip_client_mock.go b/internal/hcapi2/mock/zz_floating_ip_client_mock.go similarity index 99% rename from internal/hcapi2/zz_floating_ip_client_mock.go rename to internal/hcapi2/mock/zz_floating_ip_client_mock.go index a69424d5..2ad80d5d 100644 --- a/internal/hcapi2/zz_floating_ip_client_mock.go +++ b/internal/hcapi2/mock/zz_floating_ip_client_mock.go @@ -1,8 +1,8 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/hetznercloud/cli/internal/hcapi2 (interfaces: FloatingIPClient) -// Package hcapi2 is a generated GoMock package. -package hcapi2 +// Package hcapi2_mock is a generated GoMock package. +package hcapi2_mock import ( context "context" diff --git a/internal/hcapi2/zz_image_client_mock.go b/internal/hcapi2/mock/zz_image_client_mock.go similarity index 99% rename from internal/hcapi2/zz_image_client_mock.go rename to internal/hcapi2/mock/zz_image_client_mock.go index 3d67db17..58d4dc18 100644 --- a/internal/hcapi2/zz_image_client_mock.go +++ b/internal/hcapi2/mock/zz_image_client_mock.go @@ -1,8 +1,8 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/hetznercloud/cli/internal/hcapi2 (interfaces: ImageClient) -// Package hcapi2 is a generated GoMock package. -package hcapi2 +// Package hcapi2_mock is a generated GoMock package. +package hcapi2_mock import ( context "context" diff --git a/internal/hcapi2/zz_iso_client_mock.go b/internal/hcapi2/mock/zz_iso_client_mock.go similarity index 98% rename from internal/hcapi2/zz_iso_client_mock.go rename to internal/hcapi2/mock/zz_iso_client_mock.go index 3cf36509..383fadf5 100644 --- a/internal/hcapi2/zz_iso_client_mock.go +++ b/internal/hcapi2/mock/zz_iso_client_mock.go @@ -1,8 +1,8 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/hetznercloud/cli/internal/hcapi2 (interfaces: ISOClient) -// Package hcapi2 is a generated GoMock package. -package hcapi2 +// Package hcapi2_mock is a generated GoMock package. +package hcapi2_mock import ( context "context" diff --git a/internal/hcapi2/zz_loadbalancer_client_mock.go b/internal/hcapi2/mock/zz_loadbalancer_client_mock.go similarity index 99% rename from internal/hcapi2/zz_loadbalancer_client_mock.go rename to internal/hcapi2/mock/zz_loadbalancer_client_mock.go index ae57ed45..b0c2736f 100644 --- a/internal/hcapi2/zz_loadbalancer_client_mock.go +++ b/internal/hcapi2/mock/zz_loadbalancer_client_mock.go @@ -1,8 +1,8 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/hetznercloud/cli/internal/hcapi2 (interfaces: LoadBalancerClient) -// Package hcapi2 is a generated GoMock package. -package hcapi2 +// Package hcapi2_mock is a generated GoMock package. +package hcapi2_mock import ( context "context" diff --git a/internal/hcapi2/zz_loadbalancer_type_client_mock.go b/internal/hcapi2/mock/zz_loadbalancer_type_client_mock.go similarity index 98% rename from internal/hcapi2/zz_loadbalancer_type_client_mock.go rename to internal/hcapi2/mock/zz_loadbalancer_type_client_mock.go index cecc11d2..85449fd2 100644 --- a/internal/hcapi2/zz_loadbalancer_type_client_mock.go +++ b/internal/hcapi2/mock/zz_loadbalancer_type_client_mock.go @@ -1,8 +1,8 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/hetznercloud/cli/internal/hcapi2 (interfaces: LoadBalancerTypeClient) -// Package hcapi2 is a generated GoMock package. -package hcapi2 +// Package hcapi2_mock is a generated GoMock package. +package hcapi2_mock import ( context "context" diff --git a/internal/hcapi2/zz_location_client_mock.go b/internal/hcapi2/mock/zz_location_client_mock.go similarity index 98% rename from internal/hcapi2/zz_location_client_mock.go rename to internal/hcapi2/mock/zz_location_client_mock.go index 4c291697..7956dac5 100644 --- a/internal/hcapi2/zz_location_client_mock.go +++ b/internal/hcapi2/mock/zz_location_client_mock.go @@ -1,8 +1,8 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/hetznercloud/cli/internal/hcapi2 (interfaces: LocationClient) -// Package hcapi2 is a generated GoMock package. -package hcapi2 +// Package hcapi2_mock is a generated GoMock package. +package hcapi2_mock import ( context "context" diff --git a/internal/hcapi2/zz_network_client_mock.go b/internal/hcapi2/mock/zz_network_client_mock.go similarity index 99% rename from internal/hcapi2/zz_network_client_mock.go rename to internal/hcapi2/mock/zz_network_client_mock.go index e2b20187..714f3537 100644 --- a/internal/hcapi2/zz_network_client_mock.go +++ b/internal/hcapi2/mock/zz_network_client_mock.go @@ -1,8 +1,8 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/hetznercloud/cli/internal/hcapi2 (interfaces: NetworkClient) -// Package hcapi2 is a generated GoMock package. -package hcapi2 +// Package hcapi2_mock is a generated GoMock package. +package hcapi2_mock import ( context "context" diff --git a/internal/hcapi2/zz_placement_group_client_mock.go b/internal/hcapi2/mock/zz_placement_group_client_mock.go similarity index 99% rename from internal/hcapi2/zz_placement_group_client_mock.go rename to internal/hcapi2/mock/zz_placement_group_client_mock.go index d3eb60f8..802fcbbf 100644 --- a/internal/hcapi2/zz_placement_group_client_mock.go +++ b/internal/hcapi2/mock/zz_placement_group_client_mock.go @@ -1,8 +1,8 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/hetznercloud/cli/internal/hcapi2 (interfaces: PlacementGroupClient) -// Package hcapi2 is a generated GoMock package. -package hcapi2 +// Package hcapi2_mock is a generated GoMock package. +package hcapi2_mock import ( context "context" diff --git a/internal/hcapi2/zz_primary_ip_client_mock.go b/internal/hcapi2/mock/zz_primary_ip_client_mock.go similarity index 99% rename from internal/hcapi2/zz_primary_ip_client_mock.go rename to internal/hcapi2/mock/zz_primary_ip_client_mock.go index 14a686b3..3b3b9e7e 100644 --- a/internal/hcapi2/zz_primary_ip_client_mock.go +++ b/internal/hcapi2/mock/zz_primary_ip_client_mock.go @@ -1,8 +1,8 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/hetznercloud/cli/internal/hcapi2 (interfaces: PrimaryIPClient) -// Package hcapi2 is a generated GoMock package. -package hcapi2 +// Package hcapi2_mock is a generated GoMock package. +package hcapi2_mock import ( context "context" diff --git a/internal/hcapi2/zz_rdns_client_mock.go b/internal/hcapi2/mock/zz_rdns_client_mock.go similarity index 95% rename from internal/hcapi2/zz_rdns_client_mock.go rename to internal/hcapi2/mock/zz_rdns_client_mock.go index 221ddaef..e9522ff0 100644 --- a/internal/hcapi2/zz_rdns_client_mock.go +++ b/internal/hcapi2/mock/zz_rdns_client_mock.go @@ -1,8 +1,8 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/hetznercloud/cli/internal/hcapi2 (interfaces: RDNSClient) -// Package hcapi2 is a generated GoMock package. -package hcapi2 +// Package hcapi2_mock is a generated GoMock package. +package hcapi2_mock import ( context "context" diff --git a/internal/hcapi2/zz_server_client_mock.go b/internal/hcapi2/mock/zz_server_client_mock.go similarity index 99% rename from internal/hcapi2/zz_server_client_mock.go rename to internal/hcapi2/mock/zz_server_client_mock.go index bdc426c3..4e2586d4 100644 --- a/internal/hcapi2/zz_server_client_mock.go +++ b/internal/hcapi2/mock/zz_server_client_mock.go @@ -1,8 +1,8 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/hetznercloud/cli/internal/hcapi2 (interfaces: ServerClient) -// Package hcapi2 is a generated GoMock package. -package hcapi2 +// Package hcapi2_mock is a generated GoMock package. +package hcapi2_mock import ( context "context" diff --git a/internal/hcapi2/zz_server_type_client_mock.go b/internal/hcapi2/mock/zz_server_type_client_mock.go similarity index 98% rename from internal/hcapi2/zz_server_type_client_mock.go rename to internal/hcapi2/mock/zz_server_type_client_mock.go index 0dccda63..b204e3d9 100644 --- a/internal/hcapi2/zz_server_type_client_mock.go +++ b/internal/hcapi2/mock/zz_server_type_client_mock.go @@ -1,8 +1,8 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/hetznercloud/cli/internal/hcapi2 (interfaces: ServerTypeClient) -// Package hcapi2 is a generated GoMock package. -package hcapi2 +// Package hcapi2_mock is a generated GoMock package. +package hcapi2_mock import ( context "context" diff --git a/internal/hcapi2/zz_ssh_key_client_mock.go b/internal/hcapi2/mock/zz_ssh_key_client_mock.go similarity index 99% rename from internal/hcapi2/zz_ssh_key_client_mock.go rename to internal/hcapi2/mock/zz_ssh_key_client_mock.go index 8fb7e4d7..3d8bd86b 100644 --- a/internal/hcapi2/zz_ssh_key_client_mock.go +++ b/internal/hcapi2/mock/zz_ssh_key_client_mock.go @@ -1,8 +1,8 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/hetznercloud/cli/internal/hcapi2 (interfaces: SSHKeyClient) -// Package hcapi2 is a generated GoMock package. -package hcapi2 +// Package hcapi2_mock is a generated GoMock package. +package hcapi2_mock import ( context "context" diff --git a/internal/hcapi2/zz_volume_client_mock.go b/internal/hcapi2/mock/zz_volume_client_mock.go similarity index 99% rename from internal/hcapi2/zz_volume_client_mock.go rename to internal/hcapi2/mock/zz_volume_client_mock.go index 6cda7484..5eb20f7f 100644 --- a/internal/hcapi2/zz_volume_client_mock.go +++ b/internal/hcapi2/mock/zz_volume_client_mock.go @@ -1,8 +1,8 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/hetznercloud/cli/internal/hcapi2 (interfaces: VolumeClient) -// Package hcapi2 is a generated GoMock package. -package hcapi2 +// Package hcapi2_mock is a generated GoMock package. +package hcapi2_mock import ( context "context" diff --git a/internal/hcapi2/mock_gen.go b/internal/hcapi2/mock_gen.go deleted file mode 100644 index e2ead12d..00000000 --- a/internal/hcapi2/mock_gen.go +++ /dev/null @@ -1,19 +0,0 @@ -package hcapi2 - -//go:generate mockgen -package hcapi2 -destination zz_certificate_client_mock.go . CertificateClient -//go:generate mockgen -package hcapi2 -destination zz_datacenter_client_mock.go . DatacenterClient -//go:generate mockgen -package hcapi2 -destination zz_image_client_mock.go . ImageClient -//go:generate mockgen -package hcapi2 -destination zz_iso_client_mock.go . ISOClient -//go:generate mockgen -package hcapi2 -destination zz_firewall_client_mock.go . FirewallClient -//go:generate mockgen -package hcapi2 -destination zz_floating_ip_client_mock.go . FloatingIPClient -//go:generate mockgen -package hcapi2 -destination zz_primary_ip_client_mock.go . PrimaryIPClient -//go:generate mockgen -package hcapi2 -destination zz_location_client_mock.go . LocationClient -//go:generate mockgen -package hcapi2 -destination zz_loadbalancer_client_mock.go . LoadBalancerClient -//go:generate mockgen -package hcapi2 -destination zz_loadbalancer_type_client_mock.go . LoadBalancerTypeClient -//go:generate mockgen -package hcapi2 -destination zz_network_client_mock.go . NetworkClient -//go:generate mockgen -package hcapi2 -destination zz_server_client_mock.go . ServerClient -//go:generate mockgen -package hcapi2 -destination zz_server_type_client_mock.go . ServerTypeClient -//go:generate mockgen -package hcapi2 -destination zz_ssh_key_client_mock.go . SSHKeyClient -//go:generate mockgen -package hcapi2 -destination zz_volume_client_mock.go . VolumeClient -//go:generate mockgen -package hcapi2 -destination zz_placement_group_client_mock.go . PlacementGroupClient -//go:generate mockgen -package hcapi2 -destination zz_rdns_client_mock.go . RDNSClient diff --git a/internal/hcapi2/zz_certificate_client_base.go b/internal/hcapi2/zz_certificate_client_base.go index eb9a8982..e43af6eb 100644 --- a/internal/hcapi2/zz_certificate_client_base.go +++ b/internal/hcapi2/zz_certificate_client_base.go @@ -4,7 +4,6 @@ package hcapi2 import ( "context" - "github.com/hetznercloud/hcloud-go/hcloud" ) diff --git a/internal/hcapi2/zz_datacenter_client_base.go b/internal/hcapi2/zz_datacenter_client_base.go index bd5efa08..012c5b8d 100644 --- a/internal/hcapi2/zz_datacenter_client_base.go +++ b/internal/hcapi2/zz_datacenter_client_base.go @@ -4,7 +4,6 @@ package hcapi2 import ( "context" - "github.com/hetznercloud/hcloud-go/hcloud" ) diff --git a/internal/hcapi2/zz_firewall_client_base.go b/internal/hcapi2/zz_firewall_client_base.go index a08851cd..32c1c109 100644 --- a/internal/hcapi2/zz_firewall_client_base.go +++ b/internal/hcapi2/zz_firewall_client_base.go @@ -4,7 +4,6 @@ package hcapi2 import ( "context" - "github.com/hetznercloud/hcloud-go/hcloud" ) diff --git a/internal/hcapi2/zz_floating_ip_client_base.go b/internal/hcapi2/zz_floating_ip_client_base.go index 0de877fb..2d335a7c 100644 --- a/internal/hcapi2/zz_floating_ip_client_base.go +++ b/internal/hcapi2/zz_floating_ip_client_base.go @@ -4,7 +4,6 @@ package hcapi2 import ( "context" - "github.com/hetznercloud/hcloud-go/hcloud" ) diff --git a/internal/hcapi2/zz_image_client_base.go b/internal/hcapi2/zz_image_client_base.go index 3f1a8fc3..ba1098de 100644 --- a/internal/hcapi2/zz_image_client_base.go +++ b/internal/hcapi2/zz_image_client_base.go @@ -4,7 +4,6 @@ package hcapi2 import ( "context" - "github.com/hetznercloud/hcloud-go/hcloud" ) diff --git a/internal/hcapi2/zz_iso_client_base.go b/internal/hcapi2/zz_iso_client_base.go index 13da29fe..ccdaeff0 100644 --- a/internal/hcapi2/zz_iso_client_base.go +++ b/internal/hcapi2/zz_iso_client_base.go @@ -4,7 +4,6 @@ package hcapi2 import ( "context" - "github.com/hetznercloud/hcloud-go/hcloud" ) diff --git a/internal/hcapi2/zz_loadbalancer_client_base.go b/internal/hcapi2/zz_loadbalancer_client_base.go index 38d4cdf9..351c81a9 100644 --- a/internal/hcapi2/zz_loadbalancer_client_base.go +++ b/internal/hcapi2/zz_loadbalancer_client_base.go @@ -4,9 +4,8 @@ package hcapi2 import ( "context" - "net" - "github.com/hetznercloud/hcloud-go/hcloud" + "net" ) // LoadBalancerClientBase is an interface generated for "github.com/hetznercloud/hcloud-go/hcloud.LoadBalancerClient". diff --git a/internal/hcapi2/zz_loadbalancer_type_client_base.go b/internal/hcapi2/zz_loadbalancer_type_client_base.go index fcc3ae45..946e5aa6 100644 --- a/internal/hcapi2/zz_loadbalancer_type_client_base.go +++ b/internal/hcapi2/zz_loadbalancer_type_client_base.go @@ -4,7 +4,6 @@ package hcapi2 import ( "context" - "github.com/hetznercloud/hcloud-go/hcloud" ) diff --git a/internal/hcapi2/zz_location_client_base.go b/internal/hcapi2/zz_location_client_base.go index 934d71fb..2d3315c7 100644 --- a/internal/hcapi2/zz_location_client_base.go +++ b/internal/hcapi2/zz_location_client_base.go @@ -4,7 +4,6 @@ package hcapi2 import ( "context" - "github.com/hetznercloud/hcloud-go/hcloud" ) diff --git a/internal/hcapi2/zz_network_client_base.go b/internal/hcapi2/zz_network_client_base.go index 9c03509d..3628f0df 100644 --- a/internal/hcapi2/zz_network_client_base.go +++ b/internal/hcapi2/zz_network_client_base.go @@ -4,7 +4,6 @@ package hcapi2 import ( "context" - "github.com/hetznercloud/hcloud-go/hcloud" ) diff --git a/internal/hcapi2/zz_placement_group_client_base.go b/internal/hcapi2/zz_placement_group_client_base.go index 56cb4822..995faade 100644 --- a/internal/hcapi2/zz_placement_group_client_base.go +++ b/internal/hcapi2/zz_placement_group_client_base.go @@ -4,7 +4,6 @@ package hcapi2 import ( "context" - "github.com/hetznercloud/hcloud-go/hcloud" ) diff --git a/internal/hcapi2/zz_primary_ip_client_base.go b/internal/hcapi2/zz_primary_ip_client_base.go index c48a51bb..a30d6170 100644 --- a/internal/hcapi2/zz_primary_ip_client_base.go +++ b/internal/hcapi2/zz_primary_ip_client_base.go @@ -4,7 +4,6 @@ package hcapi2 import ( "context" - "github.com/hetznercloud/hcloud-go/hcloud" ) diff --git a/internal/hcapi2/zz_rdns_client_base.go b/internal/hcapi2/zz_rdns_client_base.go index a225fceb..6f47d0b7 100644 --- a/internal/hcapi2/zz_rdns_client_base.go +++ b/internal/hcapi2/zz_rdns_client_base.go @@ -4,9 +4,8 @@ package hcapi2 import ( "context" - "net" - "github.com/hetznercloud/hcloud-go/hcloud" + "net" ) // RDNSClientBase is an interface generated for "github.com/hetznercloud/hcloud-go/hcloud.RDNSClient". diff --git a/internal/hcapi2/zz_server_client_base.go b/internal/hcapi2/zz_server_client_base.go index 4175aac2..b663ccab 100644 --- a/internal/hcapi2/zz_server_client_base.go +++ b/internal/hcapi2/zz_server_client_base.go @@ -4,7 +4,6 @@ package hcapi2 import ( "context" - "github.com/hetznercloud/hcloud-go/hcloud" ) diff --git a/internal/hcapi2/zz_server_type_client_base.go b/internal/hcapi2/zz_server_type_client_base.go index bf9acf74..0593d66c 100644 --- a/internal/hcapi2/zz_server_type_client_base.go +++ b/internal/hcapi2/zz_server_type_client_base.go @@ -4,7 +4,6 @@ package hcapi2 import ( "context" - "github.com/hetznercloud/hcloud-go/hcloud" ) diff --git a/internal/hcapi2/zz_ssh_key_client_base.go b/internal/hcapi2/zz_ssh_key_client_base.go index 23f0fb1e..d6c422a5 100644 --- a/internal/hcapi2/zz_ssh_key_client_base.go +++ b/internal/hcapi2/zz_ssh_key_client_base.go @@ -4,7 +4,6 @@ package hcapi2 import ( "context" - "github.com/hetznercloud/hcloud-go/hcloud" ) diff --git a/internal/hcapi2/zz_volume_client_base.go b/internal/hcapi2/zz_volume_client_base.go index 9a63bbeb..c36c7fcf 100644 --- a/internal/hcapi2/zz_volume_client_base.go +++ b/internal/hcapi2/zz_volume_client_base.go @@ -4,7 +4,6 @@ package hcapi2 import ( "context" - "github.com/hetznercloud/hcloud-go/hcloud" ) diff --git a/internal/testutil/fixture.go b/internal/testutil/fixture.go index be41af14..2cc74db7 100644 --- a/internal/testutil/fixture.go +++ b/internal/testutil/fixture.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/golang/mock/gomock" - "github.com/hetznercloud/cli/internal/hcapi2" + hcapi2_mock "github.com/hetznercloud/cli/internal/hcapi2/mock" "github.com/hetznercloud/cli/internal/state" "github.com/spf13/cobra" ) @@ -12,7 +12,7 @@ import ( // Fixture provides affordances for testing CLI commands. type Fixture struct { MockController *gomock.Controller - Client *hcapi2.MockClient + Client *hcapi2_mock.MockClient ActionWaiter *state.MockActionWaiter TokenEnsurer *state.MockTokenEnsurer } @@ -23,7 +23,7 @@ func NewFixture(t *testing.T) *Fixture { return &Fixture{ MockController: ctrl, - Client: hcapi2.NewMockClient(ctrl), + Client: hcapi2_mock.NewMockClient(ctrl), ActionWaiter: state.NewMockActionWaiter(ctrl), TokenEnsurer: state.NewMockTokenEnsurer(ctrl), }