diff --git a/action.go b/action.go index a2d6320b..5bdc7de0 100644 --- a/action.go +++ b/action.go @@ -25,6 +25,8 @@ type ActionsServiceOp struct { client *Client } +var _ ActionsService = &ActionsServiceOp{} + type actionsRoot struct { Actions []Action `json:"actions"` Links *Links `json:"links"` diff --git a/action_test.go b/action_test.go index 3126f8d3..9c63da03 100644 --- a/action_test.go +++ b/action_test.go @@ -8,12 +8,6 @@ import ( "time" ) -func TestAction_ActionsServiceOpImplementsActionsService(t *testing.T) { - if !Implements((*ActionsService)(nil), new(ActionsServiceOp)) { - t.Error("ActionsServiceOp does not implement ActionsService") - } -} - func TestAction_List(t *testing.T) { setup() defer teardown() @@ -101,11 +95,11 @@ func TestAction_Get(t *testing.T) { } region := &Region{ - Name: "name", - Slug: "slug", + Name: "name", + Slug: "slug", Available: true, - Sizes: []string{"512mb"}, - Features: []string{"virtio"}, + Sizes: []string{"512mb"}, + Features: []string{"virtio"}, } if !reflect.DeepEqual(action.Region, region) { t.Fatalf("unexpected response, invalid region") diff --git a/domains.go b/domains.go index 220358b4..56e4f9b5 100644 --- a/domains.go +++ b/domains.go @@ -26,6 +26,8 @@ type DomainsServiceOp struct { client *Client } +var _ DomainsService = &DomainsServiceOp{} + // Domain represents a Digital Ocean domain type Domain struct { Name string `json:"name"` diff --git a/domains_test.go b/domains_test.go index ab26df80..6cf1bd50 100644 --- a/domains_test.go +++ b/domains_test.go @@ -8,12 +8,6 @@ import ( "testing" ) -func TestAction_DomainsServiceOpImplementsDomainsService(t *testing.T) { - if !Implements((*DomainsService)(nil), new(DomainsServiceOp)) { - t.Error("DomainsServiceOp does not implement DomainsService") - } -} - func TestDomains_ListDomains(t *testing.T) { setup() defer teardown() diff --git a/droplet_actions.go b/droplet_actions.go index be77afb6..d2037795 100644 --- a/droplet_actions.go +++ b/droplet_actions.go @@ -32,6 +32,8 @@ type DropletActionsServiceOp struct { client *Client } +var _ DropletActionsService = &DropletActionsServiceOp{} + // Shutdown a Droplet func (s *DropletActionsServiceOp) Shutdown(id int) (*Action, *Response, error) { request := &ActionRequest{"type": "shutdown"} diff --git a/droplet_actions_test.go b/droplet_actions_test.go index 6a2de492..64234c5a 100644 --- a/droplet_actions_test.go +++ b/droplet_actions_test.go @@ -8,12 +8,6 @@ import ( "testing" ) -func TestDropletActions_DropletActionsServiceOpImplementsDropletActionsService(t *testing.T) { - if !Implements((*DropletActionsService)(nil), new(DropletActionsServiceOp)) { - t.Error("DropletActionsServiceOp does not implement DropletActionsService") - } -} - func TestDropletActions_Shutdown(t *testing.T) { setup() defer teardown() diff --git a/droplets.go b/droplets.go index 5bf60a9a..844e8485 100644 --- a/droplets.go +++ b/droplets.go @@ -24,6 +24,8 @@ type DropletsServiceOp struct { client *Client } +var _ DropletsService = &DropletsServiceOp{} + // Droplet represents a DigitalOcean Droplet type Droplet struct { ID int `json:"id,float64,omitempty"` diff --git a/droplets_test.go b/droplets_test.go index 0d595a8c..48f8e57f 100644 --- a/droplets_test.go +++ b/droplets_test.go @@ -8,12 +8,6 @@ import ( "testing" ) -func TestAction_DropletsServiceOpImplementsActionService(t *testing.T) { - if !Implements((*DropletsService)(nil), new(DropletsServiceOp)) { - t.Error("DropletsServiceOp does not implement DropletsService") - } -} - func TestDroplets_ListDroplets(t *testing.T) { setup() defer teardown() diff --git a/godo_test.go b/godo_test.go index fa80045f..4137f9de 100644 --- a/godo_test.go +++ b/godo_test.go @@ -303,15 +303,6 @@ func TestDo_rateLimit_errorResponse(t *testing.T) { } } -func Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool { - interfaceType := reflect.TypeOf(interfaceObject).Elem() - if !reflect.TypeOf(object).Implements(interfaceType) { - return false - } - - return true -} - func checkCurrentPage(t *testing.T, resp *Response, expectedPage int) { links := resp.Links p, err := links.CurrentPage() diff --git a/image_actions.go b/image_actions.go index 0fada7fd..0bb355ab 100644 --- a/image_actions.go +++ b/image_actions.go @@ -16,6 +16,8 @@ type ImageActionsServiceOp struct { client *Client } +var _ ImageActionsService = &ImageActionsServiceOp{} + // Transfer an image func (i *ImageActionsServiceOp) Transfer(imageID int, transferRequest *ActionRequest) (*Action, *Response, error) { path := fmt.Sprintf("v2/images/%d/actions", imageID) diff --git a/image_actions_test.go b/image_actions_test.go index 4f7c7e33..fbac9982 100644 --- a/image_actions_test.go +++ b/image_actions_test.go @@ -8,12 +8,6 @@ import ( "testing" ) -func TestImageActions_ImageActionsServiceOpImplementsImageActionsService(t *testing.T) { - if !Implements((*ImageActionsService)(nil), new(ImageActionsServiceOp)) { - t.Error("ImageActionsServiceOp does not implement ImageActionsService") - } -} - func TestImageActions_Transfer(t *testing.T) { setup() defer teardown() diff --git a/images.go b/images.go index 9b8844e5..297deb92 100644 --- a/images.go +++ b/images.go @@ -13,6 +13,8 @@ type ImagesServiceOp struct { client *Client } +var _ ImagesService = &ImagesServiceOp{} + // Image represents a DigitalOcean Image type Image struct { ID int `json:"id,float64,omitempty"` diff --git a/images_test.go b/images_test.go index fffbe453..bcc477b2 100644 --- a/images_test.go +++ b/images_test.go @@ -7,12 +7,6 @@ import ( "testing" ) -func TestImages_ImagesServiceOpImplementsImagesService(t *testing.T) { - if !Implements((*ImagesService)(nil), new(ImagesServiceOp)) { - t.Error("ImagesServiceOp does not implement ImagesService") - } -} - func TestImages_List(t *testing.T) { setup() defer teardown() diff --git a/keys.go b/keys.go index 9c01d79a..1d0aafe5 100644 --- a/keys.go +++ b/keys.go @@ -22,6 +22,8 @@ type KeysServiceOp struct { client *Client } +var _ KeysService = &KeysServiceOp{} + // Key represents a DigitalOcean Key. type Key struct { ID int `json:"id,float64,omitempty"` diff --git a/keys_test.go b/keys_test.go index 64529038..2e05cf47 100644 --- a/keys_test.go +++ b/keys_test.go @@ -8,12 +8,6 @@ import ( "testing" ) -func TestKeys_KeysServiceOpImplementsKeysService(t *testing.T) { - if !Implements((*KeysService)(nil), new(KeysServiceOp)) { - t.Error("KeysServiceOp does not implement KeysService") - } -} - func TestKeys_List(t *testing.T) { setup() defer teardown() diff --git a/regions.go b/regions.go index 2e9c14bb..361c4b9b 100644 --- a/regions.go +++ b/regions.go @@ -13,6 +13,8 @@ type RegionsServiceOp struct { client *Client } +var _ RegionsService = &RegionsServiceOp{} + // Region represents a DigitalOcean Region type Region struct { Slug string `json:"slug,omitempty"` diff --git a/regions_test.go b/regions_test.go index 8c8aa2e0..3c725763 100644 --- a/regions_test.go +++ b/regions_test.go @@ -7,12 +7,6 @@ import ( "testing" ) -func TestRegions_RegionsServiceOpImplementsRegionsService(t *testing.T) { - if !Implements((*RegionsService)(nil), new(RegionsServiceOp)) { - t.Error("RegionsServiceOp does not implement RegionsService") - } -} - func TestRegions_List(t *testing.T) { setup() defer teardown() diff --git a/sizes.go b/sizes.go index ca4dba43..d9bbd7d6 100644 --- a/sizes.go +++ b/sizes.go @@ -13,6 +13,8 @@ type SizesServiceOp struct { client *Client } +var _ SizesService = &SizesServiceOp{} + // Size represents a DigitalOcean Size type Size struct { Slug string `json:"slug,omitempty"` diff --git a/sizes_test.go b/sizes_test.go index 54f8e9c3..55312bf9 100644 --- a/sizes_test.go +++ b/sizes_test.go @@ -7,12 +7,6 @@ import ( "testing" ) -func TestSizes_SizesServiceOpImplementsSizesService(t *testing.T) { - if !Implements((*SizesService)(nil), new(SizesServiceOp)) { - t.Error("SizesServiceOp does not implement SizesService") - } -} - func TestSizes_List(t *testing.T) { setup() defer teardown()